I managed to make this work in my project, however, I don't see params.
location:
hash:""
key:"aymkl8"
pathname: "/about/mo/18HHaYQSUs6WUWIOMaYYiI"
search:""
I need to access the id (18HHaYQSUs6WUWIOMaYYiI) in MapStateToProps. I see the id in the params normally inside the component.
There is a reason why route params are not included in redux state. What you probably want is this.
const mapState = (state, ownProps) => {
const { id } = ownProps.match.params
// rest of your mapState code
}
Thank you very much, that works.
What's the reason? To access matched params through ownProps you would need to wrap your components in withRouter HOC which entirely defeats the purpose of using this lib. What am I missing?
@em see here.
How about accessing params from a custom redux middleware that dispatches actions based on location changes
Hello there, any news on gettings the params from a redux reducer?
Actually, there is a ticket still opened on this topic
https://github.com/supasate/connected-react-router/issues/38
Most helpful comment
What's the reason? To access matched params through
ownPropsyou would need to wrap your components inwithRouterHOC which entirely defeats the purpose of using this lib. What am I missing?