Skip to content

Commit d485096

Browse files
committed
Update context for withRouter() inside static containers (test fails)
1 parent 74f93d6 commit d485096

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

modules/withRouter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react'
22
import hoistStatics from 'hoist-non-react-statics'
3+
import { ContextSubscriber } from './ContextUtils'
34
import { routerShape } from './PropTypes'
45

56
function getDisplayName(WrappedComponent) {
@@ -8,6 +9,7 @@ function getDisplayName(WrappedComponent) {
89

910
export default function withRouter(WrappedComponent) {
1011
const WithRouter = React.createClass({
12+
mixins: [ ContextSubscriber('router') ],
1113
contextTypes: { router: routerShape },
1214
render() {
1315
return <WrappedComponent {...this.props} router={this.context.router} />

0 commit comments

Comments
 (0)