I have a route configured to render the component:
<Route exact path="/page/:id" location={this.props.location} key={this.props.location.key} render={({ location }) => (
<PageStart key={this.props.location.key} />
)} />
Then inside this component (PageStart) I have:
this.props.match.params.id
But this causes an error:
Cannot read property 'params' of undefined
Passing details when just a call is component={}working fine, but not in the rendering function. Why?
source
share