Reputation: 1653
Hi I am trying to access my params from my react router but it always shows me an empty object.
this is my code:
<Switch>
<Route exact path='/' render={(props) => (<PhotoWall {...this.props}/>)}/>
<Route path='/single/:id' render={(props) => (<Single {...this.props}/>)}/>
</Switch>
I can see the value of my params in react dev tools. but i can't access it in this.props.match.params..
Upvotes: 2
Views: 3385
Reputation: 1342
It looks like you're debugging the state of a Component but not the component props that you are working on (there is a State label above the screen shot)?
Upvotes: 1