How to use Redirect in the new react-router-dom of Reactjs
You have to use setState to set a property that will render the <Redirect> inside your render() method. E.g. You can also see an example in the official documentation: https://reacttraining.com/react-router/web/example/auth-workflow That said, I would suggest you to put the API call inside a service or something. Then you could just use the history object to … Read more