Skip to content

Commit

Permalink
Remove route event in componentWillUnmount (vercel#6196)
Browse files Browse the repository at this point in the history
`Router.events.off` should be called instead of `Router.events.on` in `componentWillInmount`.
  • Loading branch information
Sklpcc authored and timneutkens committed Feb 3, 2019
1 parent 5a4176c commit 0e13d8c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/integration/with-router/components/header-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class HeaderNav extends React.Component {

componentWillUnmount () {
Router.onRouteChangeComplete = null
Router.events.on('routeChangeComplete', this.handleRouteChangeTopLevelRouter)
Router.events.off('routeChangeComplete', this.handleRouteChangeTopLevelRouter)
this.props.router.events.off('routeChangeComplete', this.handleRouteChange)
}

Expand Down

0 comments on commit 0e13d8c

Please sign in to comment.