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 use with Router? E.g. connected-react-router? #49

Closed ghost closed 5 years ago

ghost commented 5 years ago

I'm using redux-react-hook with react-router-dom which works fine. Now I want to connect the router to Redux, such that it dispatches actions when I'm routing and give me the ability to route using actions.

Previously I'd use connected-react-router for that, but that's dependent on react-redux.

Is this possible?

ianobermiller commented 5 years ago

You'll have to find another option that doesn't tie into react-redux, or just use a hook like https://github.com/CharlesStover/use-react-router to access the route data. Alternatively, just keep using react-redux and connected-react-router to get it into the store, but use redux-react-hook for actually accessing the store.