We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 74f93d6 commit d485096Copy full SHA for d485096
modules/withRouter.js
@@ -1,5 +1,6 @@
1
import React from 'react'
2
import hoistStatics from 'hoist-non-react-statics'
3
+import { ContextSubscriber } from './ContextUtils'
4
import { routerShape } from './PropTypes'
5
6
function getDisplayName(WrappedComponent) {
@@ -8,6 +9,7 @@ function getDisplayName(WrappedComponent) {
8
9
10
export default function withRouter(WrappedComponent) {
11
const WithRouter = React.createClass({
12
+ mixins: [ ContextSubscriber('router') ],
13
contextTypes: { router: routerShape },
14
render() {
15
return <WrappedComponent {...this.props} router={this.context.router} />
0 commit comments