What is difference between react-router 4.0, react-router-dom and react-router-redux?
react-router
v4 is base, building block. Provides API for creating routing solution.
react-router-dom
is wrapper around react-router
. It is supposed to be run in browser.
react-router-redux
offers so called "controlled router", bound to redux
store. State changes (navigation) could be controlled by dispatching redux
actions as well as by clicking on links.
Your best bet is to start with react-router-dom
(which pulls in react-router
for you by default).
Very very simple explanation!!!
- No need to use
react-router
directly. react-router-dom
is made for "Web application" andreact-router-native
is made for "react native mobile apps".react-router-dom
&react-router-native
usesreact-router
at core.- react-router-dom works perfectly fine with Redux, NO NEED of
react-router-redux
. (confirmed by Dan abramov - creator of Redux) - Extra Benefit of
react-router-redux
is you can keep your router in sync with application state. - In nutshell - history + store (redux) →
react-router-redux
- react-router exports shared, core modules for native (react-router-native) and web development (react-router-dom)
- Use react-router-dom for web development
- Use react-router-native for native development
- Use react-router-redux to integrate react-redux and react-router in order to, for instance, navigate via
store.dispatch()