javascript - React-router need a way to detect route change -


i search way detect route change / leave. try exemple https://github.com/rackt/react-router/blob/master/docs/guides/advanced/confirmingnavigation.md can't make work in project.

http://pastebin.com/txw71gmv

i need next route too, route argument onleave doesn't provide anything.

i know can detect url document.location in onleave function, want more consistant or built in.

does can me this?

thank you

the route leave hook indeed called next location, when transition triggered react router.

if you're leaving page outright, you're not going see this, because hitting "before unload" hook, router can't build next location, since it's not router managing.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -