For example I have this routes:
- /login: for login screen
- /home: for home screen
At Home screen, I logout, and I want it come to again /login screen as loading new page (so all states are new). How can I do that in React using React router.
For example I have this routes:
At Home screen, I logout, and I want it come to again /login screen as loading new page (so all states are new). How can I do that in React using React router.
You can 'redirect' like this:
import { browserHistory } from "react-router";
browserHistory.push('/someroute');
And if you want to reset your state - do it in componentWillReceiveProps
componentWillReceiveProps(nextProps) {
var currentLocation = nextProps.location.pathname;
if(currentLocation=='someroute')
//your logic
}