Skip to content

Instantly share code, notes, and snippets.

@Landish
Created November 16, 2017 17:36
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 Landish/1ee61b38fb2ee6f1fc8e5499d4ebfeeb to your computer and use it in GitHub Desktop.
Save Landish/1ee61b38fb2ee6f1fc8e5499d4ebfeeb to your computer and use it in GitHub Desktop.
Reload Current Page With React Router 4
componentWillReceiveProps(nextProps) {
  const currLocationKey = this.props.location.key;
  const nextLocationKey = nextProps.location.key;
  if (currLocationKey !== nextLocationKey) {
    // do the magic here
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment