emmenko / redux-react-router-async-example

A showcase of the Redux architecture with React Router
http://emmenko.github.io/redux-react-router-async-example
MIT License
935 stars 131 forks source link

Redux Router VS React Router Redux #64

Open yanivefraim opened 8 years ago

yanivefraim commented 8 years ago

It would be really interesting if you can tell about the decision of using Redux Router over React Router Redux.

I saw that you had an issue for using React Router Redux, and finally you chose the Redux Router.

Can you share your knowledge about this? 10x!

sjmas commented 8 years ago

I'm wondering the same thing. Some insight would be really helpful. redux-router's README has a comparison sections with some caveats, but ultimately says its advisable to use react-router-redux without really explaining why.

brettdh commented 8 years ago

I'm making the same evaluation right now and having the same difficulty.

I get the sense (possibly from something @gaearon wrote somewhere) that one big reason is that redux-router is not as well maintained. This twitter search is all I could find right now, though even the message from just that seems pretty clear (if unelaborated). Having the docs described in this issue will be a big help, I hope.

@yanivefraim the issue you link to actually discusses using redux-react-router, which became redux-router. There was also once redux-simple-router, which became react-router-redux.

gaearon commented 8 years ago

You don’t need either, why not just use React Router directly?

gaearon commented 8 years ago

(I wouldn’t suggest redux-router at all, and you only want react-router-redux if you want DevTools support.)

brettdh commented 8 years ago

Thanks @gaearon. I'm assuming you meant react-router-redux above (since that was the link target). This conversation was quite helpful for me in piecing this together. DevTools support does seem quite useful.

I was waffling for a while because of this caveat regarding router state in mapStateToProps (we have components deep in the tree that need to access location state). But I figure I can still use withRouter in that context and stop worrying about it.

gaearon commented 8 years ago

I was waffling for a while because of this caveat regarding router state in mapStateToProps (we have components deep in the tree that need to access location state). But I figure I can still use withRouter in that context and stop worrying about it.

Exactly.

yanivefraim commented 8 years ago

Thanks for the insights!

@gaearon - I would like to cease the opportunity and ask a (somehow related) question about Redux/React/Router. I already asked it here but did not get a proper answer...

In short: It seems really strange to me that Redux state persists across page navigations (even that we are talking about single page application, I don't really see the difference). I think the while navigating to a url application state must be clean. And I can show several examples about problems with keeping state between navigations:

I would really love to hear your opinion about this. Thanks! Yaniv