javascript – So erzielen Sie den vorherigen onEnter-Effekt in React-Router Version 4.0
三叔
三叔 2017-07-05 11:03:58
0
1
892

Ich habe die offizielle Dokumentation überprüft und es scheint, dass dies nicht erwähnt wird

三叔
三叔

Antworte allen(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.

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage