From the course: TanStack Query: Efficient Data Fetching and State Management

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Rendering repository data

Rendering repository data

- [Instructor] Now we actually need to send the query from the component, and we're going to do that with a familiar function, which is useQuery. We're already using useQueries, but we have to use useQuery in this case. useQuery is going to be used within our UserRepositories. So UserRepositories, let's go ahead and add username, and this is going to be set to a type annotation called UserRepositoriesProps. Okay, so what is that? We need to create it. Let's go ahead and create an interface. This interface is going to house any of these properties that we need. In this case, it's only one, so we'll say UserRepositoriesProps. That's not an easy word to spell, but we did it, unless I spelled it wrong, and we'll go ahead and set that to a string. Okay, so that's looking good. The next thing that we'll do is actually call the useQuery hook. So const, we'll open and close a set of curly braces, and set that to useQuery. So what we'll have here is data. We're going to set the data to repos…

Contents