Skip to content
This repository has been archived by the owner on Jan 4, 2018. It is now read-only.

Redux Router VS React Router Redux #64

Open
yanivefraim opened this issue May 2, 2016 · 7 comments
Open

Redux Router VS React Router Redux #64

yanivefraim opened this issue May 2, 2016 · 7 comments

Comments

@yanivefraim
Copy link

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
Copy link

sjmas commented May 19, 2016

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
Copy link

brettdh commented Aug 2, 2016

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
Copy link
Contributor

gaearon commented Aug 2, 2016

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

@gaearon
Copy link
Contributor

gaearon commented Aug 2, 2016

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

@brettdh
Copy link

brettdh commented Aug 2, 2016

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
Copy link
Contributor

gaearon commented Aug 2, 2016

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
Copy link
Author

yanivefraim commented Aug 2, 2016

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:

  • User fills a form, and navigating to another page. When he navigates to this page again - do you want him to see the leftovers of what he had before? If not, you will have to take care of it manually.
  • When a user navigates directly to a page inside your app (not from home page, lets say the user directly types a.html/page1/bla in his browser), is it reasonable that he would get a different results then a user navigating to same address from a different page (because he has different state...)

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants