Closed
Description
I'm having some trouble figuring out how to complete the cycle of a user hitting /groups/id
, fetching the right data, adding it to the store, and finally grabbing it from the store to my component. I've basically got everything except for the last one.
I'm just having trouble with the @connect
part.
This is my code, and basically I want to have the routerParams available in mapStateToProps
, I thought ownProps
would have it but that's always undefined for some reason. So I am unable to grab the correct group. Any idea how I can access the routerParam from the mapStateToProps function, or what I'm doing wrong here?
function mapStateToProps(state, ownProps) {
console.log(ownProps);
return {
group: state.groups[0]
}
}
@connect(
mapStateToProps,
dispatch => bindActionCreators(groupActions, dispatch)
)
Metadata
Metadata
Assignees
Labels
No labels