Using Query Parameters

Learn to use query parameters in React.

A query parameter is part of the URL that allows additional parameters to be passed into a path. For example, /search?criteria=typescript has a query parameter called criteria with a value of typescript. Query parameters are sometimes referred to as a search parameter.

Implementing query parameter

In this section, we are going to implement a query parameter on the search page called criteria, which will drive the search. We’ll implement the search page along the way. Let’s carry out the following steps to do this:

  1. We are going to start in QuestionsData.ts by creating a function to simulate a search via a web request:

Get hands-on with 1200+ tech skills courses.