Skip to content

Instantly share code, notes, and snippets.

@Om4ar
Created July 23, 2018 22:57
Show Gist options
  • Save Om4ar/9b55ae47d49c45fbd01e46dc378379ec to your computer and use it in GitHub Desktop.
Save Om4ar/9b55ae47d49c45fbd01e46dc378379ec to your computer and use it in GitHub Desktop.
how to deal with hash change in react
componentDidMount() {
window.addEventListener("hashchange", this.props.ShowTabWithHash, false);
}
componentWillUnmount() {
window.removeEventListener("hashchange", this.props.ShowTabWithHash, false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment