Skip to content

timarney/react-router-redux-query-params

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#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)

About

React Router Params via Redux State

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published