I need to implement a UCenter page called User and a Login page called LOGIN.
I now put the code to judge whether to log in or not and jump into User’s componentWillMount () inside. The first time you open User, you can jump directly to the Login page.
However, when I jump to the Login page and close the Login page directly, I can still return to the User page directly. This is not in line with my expectation. I hope that as long as the User is not logged in, the user page will be opened and guided to the Login page.
This situation is that componentWillMount () is called only once when the page is loaded for the first time. what method is called every time the page is loaded to achieve the desired effect?
This example can be used for interception by using the onEnter attribute of react-router.https://github.com/ReactTrain …