Skip to content

Instantly share code, notes, and snippets.

@emilong
Last active April 11, 2016 21:41
Show Gist options
  • Save emilong/55148d814039ee9e4201527ae7cf8e42 to your computer and use it in GitHub Desktop.
Save emilong/55148d814039ee9e4201527ae7cf8e42 to your computer and use it in GitHub Desktop.
// Make sure not to bind this function before passing it as onUpdate
// to Router below since it will be called with this set to the Router
// instance.
function onLocationChange() {
doSomethingInterestingWithPath(this.state.location.pathname);
}
...
<Router routes={routes} onUpdate={onLocationChange} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment