jfairbank/redux-saga-router

Feature request: afterRouteChange and/or onRouteChange options

Opened this issue · 0 comments

I frequently run into situations where it would be helpful to know that a route has just changed or is in the process of changing.

Think of something like React's lifecycle methods.

As an example, it might be handy to know that a user has just navigated between two given routes in order to refresh the data held in redux state.

example:

const options = {
  *onRouteChange({ routeParams, nextRouteParams }) {
    if ( routeParams.section === 'user' && nextRouteParams.subsection === 'posts' ) {
          // do something with the params
    }
  }
}