Skip to content

Docs: Usage with React Router #637

Closed
@gaearon

Description

@gaearon

People constantly get the impression we don't support React Router, or that you need something special like redux-react-router for it to work, or even that it doesn't work until React 0.14.

You can use Redux with React Router 0.13 or 1.0 as is today.
(And that was true since Redux's initial release by the way.)

Some features like time travel will need to wait for some support on RR side, but this is irrelevant to the main issue. People get confused thinking they can't use routing today, which is just wrong.

The real world example included in this repo uses React Router. All you need is to wrap <Router> into <Provider>, just like you'd wrap your top-level component in a router-less app.

If you want to transition from action creators, pass router instance as a parameter to action creators, and call its methods when you like. If you want to read router state from Redux store, fire an action on route change and write a reducer to handle it. That's it!

react-redux-router is an experiment in trying to come up with a more natural API where you'd just dispatch actions and read state from store which automagically is connected to the router instance, but you don't have to use it, or to wait for it to become stable! It's an experiment only.

We need this in docs..

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions