Open ralphievolt opened 6 years ago
It doesn't really make sense to use that function in the component lifecycle methods since your components are mounted (and unmounted) by the router.
The only reason I'd like to use it is to get the value of the url params. Currently to get the values is to encapsulate my components with withRouter the use props.params.
So I was thinking if subscribe
can do the job of my need
Yeah probably too complicated. If you don't like HoC's you can always turn withRouter into a render props component.
Will I be able to call this function in componentDidMount and how? My test yields nothing
subscribe(({ path, params }) => console.debug('route: ', { path, params }));