How to get query parameters in React Router v4?

Posted by Prem Tiwari | Updated on | ReactJS interview

How to get query parameters in React Router v4?

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.

You can also use URLSearchParams if you want something native:

You should use a polyfill for IE11.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers