I subscribe to route changes with
browserHistory.listen(fn)
but how can I unsubscribe?
I have tried assigning to listen
null
, but it complains about not being a function.
The return from listen
is a function that will unsubscribe the listener when called. So just save it for later:
var unlisten = browserHistory.listen(fn)
// ...some time later...
unlisten()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With