When declaring a route as follows:
App.js
<Route path="/:id" component={RunningProject} />
I can get id parameter in RunningProject.js, like this
constructor(props){
super(props)
console.log(props.match.params.id);
}
But when declaring a route like this
<Route path="/:id" render={() => <RunningProject getProjectById={this.getProject} />} />
I get an error because the match is no longer passed to the details.
How to pass a matching object in propsusing render=instead component=?
source
share