Retrieving data from the server
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.)
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.