I'm trying to fetch URL query params with react-router by access to props.location.query, but the query is undefined. how can fetch them?
URL example - http://localhost:3000/home?param1=tomato¶m2=potato
I'm trying to fetch URL query params with react-router by access to props.location.query, but the query is undefined. how can fetch them?
URL example - http://localhost:3000/home?param1=tomato¶m2=potato
//Try this way without any lib.
const query = new URLSearchParams(this.props.location.search);
const param1 = query.get('param1');
const param2 = query.get('param2');