javascript - How to achieve the previous onEnter effect in react-router version 4.0
三叔
三叔 2017-07-05 11:03:58
0
1
889

I checked the official documents and it doesn’t seem to mention this

三叔
三叔

reply all(1)
phpcn_u1582

React Router v3 provides onEnter, onUpdate, and onLeave methods. These were essentially recreating React's lifecycle methods.

With v4, you should use the lifecycle methods of the component rendered by a <Route>. Instead of onEnter, you would use componentDidMount or componentWillMount. Where you would use onUpdate, you can use componentDidUpdate or componentWillUpdate (or possibly componentWillReceiveProps). onLeave can be replaced with componentWillUnmount.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template