Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-router-redux vs connected-react-router for react v4

official github page of react-router-redux says that the project is no longer maintained and is now deprecated. They recommend to use connected-react-router instead. react-router-redux has:
31k stars 884 watch
6k forks
while connected-react-router has only:
1053 stars
28 watch
108 forks

I am starting developing a complete Q/A social networking website using react v4, will it be worthy or smart idea to use connected-react-router here?

while posting the question I just noticed that the stackoverflow doesn't even have connected-react-router tag.

like image 744
Puspender Avatar asked Aug 06 '18 08:08

Puspender


1 Answers

If you are going to use Redux to manage your application state, use react router for routing, and want to synchronize your route history with your app state and manage routing through redux, then this will be fine to use. While I've only begun using it recently myself it's made been pretty straight forward for managing routing, including route data.

You also pointed out that:

react-router-redux says that the project is no longer maintained

For this reason alone I would not use react-router-redux, unless you plan to maintain it yourself. Disregarding features and bugs, you'd also have to be concerned with any potential security issues that come up. Please also see this dicussion they're having about it's deprecation in their GitHub issues https://github.com/ReactTraining/react-router/issues/6358

Just to reiterate, if you need, or think you'll need, to synchronize your router state with your redux store then this is not a bad tool to use. If you don't think you'll need this then don't use it so your project doesn't become bloated.

That being said, I've also seen this alternative https://github.com/salvoravida/redux-first-history which looks interesting. It looks to offer a more decoupled approach to history, routing, and state than the connected-react-router, but I haven't used it yet.

like image 161
Blacky Wolf Avatar answered Oct 24 '22 00:10

Blacky Wolf