Reputation: 936
<Route path="lookbook" component={Photos} onEnter={onPageEnter}>
<Route path=":photoIdentifier" component={PhotoDetailsModal} onEnter={onPageEnter}>
</Route>
</Route>
So if I am in PhotoDetailsModal
and console.log
this.props
. I notice that my :photoIdentifier
parameter exists in two different spots. In this.props.params.photoIdentifier
and as this.props.routeParams.photoIdentifier
. What is the difference between these two?
Upvotes: 0
Views: 181
Reputation: 281874
routeParams
is a subset of this.props.params
that were directly specified in this component's route.
For example, if the route's path is lookbook/:photoIdentifier
and the URL is /lookkook/123/photoId/345
then this.props.routeParams will be {photoIdentifier: '123'}
, and this.props.params
will be {photoIdentifier: '123', photoId: 345}
.
I suppose this answers yours question
Upvotes: 1