Answer the question
In order to leave comments, you need to log in
What is the best way to check if a react-routerv4 route is correct?
there is such a route: 'somepath/:id/:page'
As usual, for example, the id parameter is checked for the fact that it belongs to the user.
Now my access to somepath is limited by the private router, and the check that the user's id is not equal to :id is in did mount.
But I don't really like the idea of did mount with
react-redux
Answer the question
In order to leave comments, you need to log in
Here is an article just about this https://tylermcginnis.com/react-router-protected-r...
You make a PrivateRoute component (in your case it can be called differently, for example PrivatePageRoute) and check in it whether it is possible or not. And if not, then show an error message or output <Redirect to={...}>
to redirect to the right place.
everything is easy
реврайт конд реквест ури ^(flowers.)(*)&
реврайт рул http://syte.ru/%2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question