This video is available to students only

Fetching data

Retrieving data from the server

Fetching data#

For this lesson we'll return to the client code. We're going to add a "Get Data" button with an onClick handler that calls the API just below the query builder. (This could also be a useEffect hook that fetches data when the query changes.)

The getData function will call the API with the user's query. We also need a state variable to hold the results of the API call.

No discussions yet