From [email protected] and onwards, your router instance is compatible with most observable libraries.
You can subscribe to route changes using router.subscribe(), and will receive an object containing route and previousRoute.
router.subscribe()
route
previousRoute
Router instances are observables. You can use most stream libraries out there and create a stream from your router instance:
RxJS (Rx.Observable.from(router))
Rx.Observable.from(router)
xstream (xs.fromObservable(router))
xs.fromObservable(router)
most (most.from(router))
most.from(router)
etc...
Last updated 7 years ago