react route send informaion in url

Solutions on MaxInterview for react route send informaion in url by the best coders in the world

showing results for - "react route send informaion in url"
Ornella
22 Apr 2020
1// your route setup
2<Route path="/category/:catId" component={Category} / >
3
4// your link creation
5const newTo = { 
6  pathname: "/category/595212758daa6810cbba4104", 
7  param1: "Par1" 
8};
9// link to the "location"
10// see (https://reacttraining.com/react-router/web/api/location)
11<Link to={newTo}> </Link>
12
13// In your Category Component, you can access the data like this
14this.props.match.params.catId // this is 595212758daa6810cbba4104 
15this.props.location.param1 // this is Par1
16