redux: With react-router, redux will not work.

I’m a flummox’s user, as @acdlite suggest, i try to use redux.

I use react-router v1.0-beta2, I found when I use {this.props.children} to use ‘component of redux’, @connect, then will report error: Failed Context Types: Required context 'redux' was not specified in 'Connector'. Check the render method of 'Connector(DashboardApp)'

It seems react-router disabled the ‘redux’ context, so what should I do ?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 26 (15 by maintainers)

Commits related to this issue

Most upvoted comments

To have hot reloading properly working, you’ll need to have a root component that returns <Router> wrapped in <Provider> from its render, and imports stores.

If you import stores in index.js, hot reloading them indeed won’t work.

@gaearon Thanks! You are great, I will to learn more from you!

ps. this can not use before super(), this should be

constructor(props) {
    super(props)
    this.history = new BrowserHistory()
}

@ustccjw

Thanks for reporting! You should be able to do something like

class AppContainer extends Component {
  constructor(props) {
    this.history = new BrowserHistory();
    super(props);
  }

  render() {
    return (
      <Provider>{() =>
        <Router history={this.history}>
           ...
        </Router>
      }</Provider>
    );
  }

@mjackson @ryanflorence No plans to support swapping history object on the go?