in React JS by
Q:

How to get query parameters in React Router v4?

1 Answer

0 votes
by

The ability to parse query strings was taken out of React Router v4 because there have been user requests over the years to support different implementation. So the decision has been given to users to choose the implementation they like. The recommended approach is to use query strings library.

const queryString = require('query-string');
const parsed = queryString.parse(props.location.search);

You can also use URLSearchParams if you want something native:

const params = new URLSearchParams(props.location.search)
const foo = params.get('name')

You should use a polyfill for IE11.

Click here to read more about React JS
Click here to read more about Insurance

Related questions

+1 vote
asked Mar 2, 2020 in React JS by RShastri
0 votes
asked Mar 2, 2020 in React JS by RShastri
0 votes
asked Nov 26, 2019 in React JS by AdilsonLima
0 votes
asked Jan 31 in React JS by Robindeniel
0 votes
0 votes
asked Mar 4, 2020 in React JS by JackTerrance
+1 vote
+1 vote
asked Mar 2, 2020 in React JS by RShastri
...