简体   繁体   中英

What is the difference between react-router and react-router redux?

I am working on creating a simple application and using react-router for routing, now for state management I am using redux . I would like to know the difference between react-router and react-router-redux to implement in my application. Thanks in advance.

react-router is powerful enough. react-router-redux is middleware relates react-router and redux. it's useful for maintaining routing state in store

React router is used for routing in reactjs. Check this a bit of code with react-router.

React-router-redux is used to save the current url location to the state, so when you do features like time travel in redux, the url will be given to react-router. React-router-redux has got almost nothing to do with routing in reactjs and has more to do with redux.

This library is not necessary for using Redux together with React Router. You can use the two together just fine without any additional libraries. It is useful if you care about recording, persisting, and replaying user actions, using time travel. If you don't care about these features, just use Redux and React Router directly.

Refer react-router-redux docs

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM