facebookarchive / redux-react-hook

React Hook for accessing state and dispatch from a Redux store
MIT License
2.16k stars 103 forks source link

How to make this works with ConnectedRouter ? #51

Closed kunyan closed 5 years ago

kunyan commented 5 years ago

The ConnectedRouter require a <Provider> in the root, However, the redux-react-hook is using context to replace it.

I have try to use

<StoreContext.Provider value={store}>
    <Provider store={store}>
      <ConnectedRouter history={browserHistory}>
        <Switch>
          ...
        </Switch>
      </ConnectedRouter>
    </Provider>
  </StoreContext.Provider>

But looks not works perfectly

ianobermiller commented 5 years ago

Can you provide a codesandbox with a repro? You will need to use the react-redux Provider if you want to use ConnectedRouter. Otherwise, you will have to look for another solution, see #49.