Git Product home page Git Product logo

Comments (7)

sjmas avatar sjmas commented on July 4, 2024 2

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.

from redux-react-router-async-example.

gaearon avatar gaearon commented on July 4, 2024 1

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

from redux-react-router-async-example.

brettdh avatar brettdh commented on July 4, 2024

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.

from redux-react-router-async-example.

gaearon avatar gaearon commented on July 4, 2024

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

from redux-react-router-async-example.

brettdh avatar brettdh commented on July 4, 2024

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.

from redux-react-router-async-example.

gaearon avatar gaearon commented on July 4, 2024

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.

from redux-react-router-async-example.

yanivefraim avatar yanivefraim commented on July 4, 2024

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

from redux-react-router-async-example.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.