Skip to content

Instantly share code, notes, and snippets.

@juusaw
Created February 5, 2017 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juusaw/904dbb92dc4bc8690cd421faabf2bfb2 to your computer and use it in GitHub Desktop.
Save juusaw/904dbb92dc4bc8690cd421faabf2bfb2 to your computer and use it in GitHub Desktop.
Action creator for react-router-redux path change
import { push } from 'react-router-redux'
/**
* Action creator to perform a route change from a component.
* Simply pass the action creator to the component and call it
* like `this.props.routePath('/route/here')`
*
* @param {string} path The path to navigate to.
*
* @return {Object} Action to dispatch for route change.
*/
export function routePush(path) {
return push(path)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment