Coder Social home page Coder Social logo

Comments (9)

kadmil avatar kadmil commented on May 9, 2024

I've asked for this, and actually react-router passes all the things into route handler component props. Seemingly, need to update docs on this.

from react-router-redux.

kadmil avatar kadmil commented on May 9, 2024

Just use your route handler's props — all is there already.

from react-router-redux.

brandondoran avatar brandondoran commented on May 9, 2024

Thanks for that tip @kadmil!

To add to that, if you're using the react-redux connect api, you can add a second argument to your mapStateToProps function. It's value will be the props passed into the the component, including router info like routes, params, location, etc.

from react-router-redux.

dsteinbach avatar dsteinbach commented on May 9, 2024

I must have a configuration problem because the only thing I have under state.routing is path.

from react-router-redux.

dsteinbach avatar dsteinbach commented on May 9, 2024

Argh sorry. Ok I see this all in the route handler props. Thanks!

from react-router-redux.

dsteinbach avatar dsteinbach commented on May 9, 2024

Hmm I might stick with redux-router because having all the routing info in state is just too handy and having to pass around props is going to clutter up my components with dependencies. Although I could create an action that moves this info to state every time the url updates.

from react-router-redux.

kadmil avatar kadmil commented on May 9, 2024

@dsteinbach hey, what's the difference between taking routing details from redux-router reducer in mapStateToProps or direct component props? And there's an action with update in this project — UPDATE_PATH. So, if only reasons are just routing state — it's not show-stopper here.

from react-router-redux.

dsteinbach avatar dsteinbach commented on May 9, 2024

The difference is with redux-router I can grab routing details from any nested component but with redux-simple-router I have to pass props from route handler component down to all the children that need routing details.

from react-router-redux.

jlongster avatar jlongster commented on May 9, 2024

@dsteinbach I like to encourage only top-level routing components directly access router props. This aligns with redux's philosophy that generally only top-level components should be "connected". With react-router you can build a deep nested tree but with route components, so the bottom route component still have access to routing props and it's quite deep in the tree.

from react-router-redux.

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.