Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

React Router v4 #2

Closed
simenbrekken opened this issue Feb 27, 2017 · 0 comments · Fixed by #4
Closed

React Router v4 #2

simenbrekken opened this issue Feb 27, 2017 · 0 comments · Fixed by #4

Comments

@simenbrekken
Copy link
Contributor

Instead of a Provider type class that exposes registerDependency we could use the new staticContext:

static contextTypes = {
  router: PropTypes.shape({
    staticContext: PropTypes.object,
  }).isRequired,
}

componentWillMount() {
  const { staticContext } = this.context.router

  if (staticContext) {
    staticContext.registerDependency(this.dispatchIfNeeded(this.props))
  }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant