Chooce video playback speed
speed:1

Fetch REST data using React Query’s useQuery hook

InstructorDomitrius Clark

Share this video with your friends

Send Tweet

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.

This lesson is a Community Resource

A Community Resource means that it’s free to access for all. The instructor of this lesson requested it to be open to the public.

Craig Doremus
Craig Doremus
~ 4 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