Comments (9)
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.
Just use your route handler's props — all is there already.
from react-router-redux.
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.
I must have a configuration problem because the only thing I have under state.routing
is path
.
from react-router-redux.
Argh sorry. Ok I see this all in the route handler props. Thanks!
from react-router-redux.
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.
@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.
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.
@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)
- with react-router 4.X and react-router-redux 5.0, the devTools can not replay different path HOT 3
- Expose defaultSelectLocationState HOT 2
- Action name HOT 2
- about goBack and go(-1) HOT 1
- Error: Element type is invalid: expected a string HOT 1
- example change url but not component HOT 1
- why browserHistory not working?
- Why there is no action creator for LOCATION_CHANGE? HOT 2
- routes not working properly HOT 1
- how to use hashRouter in react-router-redux HOT 1
- push() replaces url HOT 4
- History with other sites. HOT 1
- basename not working on react-router-redux 5.0.0-alpha.9 HOT 1
- Where is `this.props.location` and `this.props.history` in react-router-redux? HOT 1
- How does `selectLocationState` work? Give examples HOT 3
- LOCATION_CHANGE is wrong action type HOT 1
- How to preserve router in ownProps? HOT 1
- -router
- Ability to modify 'location' with my own reducer? HOT 1
- The readme section "We're moving" is misleading. The "new" location says *Project Deprecated* HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-router-redux.