Grokking React Native
Vote

0% completed

​

Fetching Data with useQuery

A query is a request to read data, tied to a unique name, so that React Query can store the answer and find it again. The useQuery hook is how a component declares a query. You give it the name and a function that fetches the data, and it returns the current state of that data on every render.

The Running Example: a List of Users

This screen loads users from a free test API and shows their names. Save it as UsersScreen.js, import it in App.js, and render <UsersScreen /> inside QueryClientProvider in place of the placeholder View. It uses `FlatList

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content