Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cristinallamas/4a9bbd245c281cfe87ad560200dfd9ef to your computer and use it in GitHub Desktop.
Save cristinallamas/4a9bbd245c281cfe87ad560200dfd9ef to your computer and use it in GitHub Desktop.
Detect Route change in ReactJS
import { withRouter } from 'react-router-dom';
history.listen((location, action) => {
console.log("on route change");
// Do stuff.
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment