https://github.com/timarney/react-router-redux-query-params
React Router Params via Redux State
https://github.com/timarney/react-router-redux-query-params
Last synced: 10 months ago
JSON representation
React Router Params via Redux State
- Host: GitHub
- URL: https://github.com/timarney/react-router-redux-query-params
- Owner: timarney
- License: mit
- Created: 2016-04-21T19:05:01.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-05T17:25:15.000Z (about 10 years ago)
- Last Synced: 2025-04-09T17:56:59.025Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 118 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#Get Query Param Demo
Keeps Redux as 'the source of truth' using React Redux Router to sync with the url.
This demo shows how to grab location query param from React Router using a Redux connected component.
```
function mapStateToProps (state, ownProps) {
return {
num: state.items.num,
query: ownProps.location.query
}
}
export default connect(mapStateToProps, null)(YourComponent)
```
#Why is this important?
This type of setup would allow an app to repopulate state based on a url location.
#To Run
npm install -> npm start (runs dev server)