Redirect to previous path on login – React Router v4

Posted by Prem Tiwari | Updated on

Following this example you can make a component PrivateRoute to wrap Route and use that whenever you need a route that requires auth.

This is the component code from the example.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers