An open API service indexing awesome lists of open source software.

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

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)