Created
January 8, 2019 15:58
-
-
Save cristinallamas/4a9bbd245c281cfe87ad560200dfd9ef to your computer and use it in GitHub Desktop.
Detect Route change in ReactJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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