I am using response-router-redux ( https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux )
installed with
npm install --save react-router-redux@next
runs like this:
<Route path='/resource/:id' component={Resource}/>
I am trying to access the id parameter in a container, for example:
const mapStateToProps = (state, ownProps) => {
console.log(ownProps)
return {...state.resource, id: ownProps.params.id}
}
As shown in the doc-router-abbreviation docs.
I get an error indicating that ownProps.params is undefined. So this works:
const mapStateToProps = (state, ownProps) => {
return {...state.resource, id: ownProps.match.params.id}
}
However, when I register my ownProps, I find that ownProps.match.params.id contains the required identifier.
Is this a change in implementation or have I used the route incorrectly? Thanks