⚠️ This lesson is retired and might contain outdated information.

Fetch REST data using React Query’s useQuery hook

Domitrius Clark
InstructorDomitrius Clark
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 2 years ago

We're going to quick dive into how to utilize useQuery to fetch some data for us, set up a loading state, and display it in our JSX. We'll also wire up the React Query Devtools and discuss some features.

Craig Doremus
Craig Doremus
~ 3 years ago

I understand that the recently released react-query version 3 made some significant changes to the API. How do those changes affect the code examples shown here?

I've done some work on this myself and found that when react-query is updated from version 1.0 to 3.5, there are significant differences in the API and Dev Tools. Working code for this example can be found here: https://codesandbox.io/s/egghead-react-query1-bxsc4?file=/src/App.js

An upgrade guide to version 3 can be found here: https://react-query.tanstack.com/guides/migrating-to-react-query-3

Markdown supported.
Become a member to join the discussionEnroll Today