Configure React Query Devtools and inspect existing queries

Tomasz Ducin
InstructorTomasz Ducin
Share this video with your friends

Social Share Links

Send Tweet
Published 5 months ago
Updated a week ago

React Query Devtools provides a component that you can use to see and perform actions on every query in your app.

[00:00] Open the console again and let's type npm install tanstack slash react query dev tools. Unlike many other dev tools, these are not going to be a browser extension. This is going to be an NPM package that includes a component which we are going to [00:19] include into our application hierarchy. So let's put this component just near the main content of our application. So near the router provider. The component is called React Query Dev Tools. And it's being imported over here from 10stack slash react [00:39] query dev tools package we have just installed. And there is one prop we might be interested in setting. This is initial is open, which accepts a boolean. So depending on what is the value, initially, the DevTools might be open or not. So after I save this file, take a look at [00:59] the right hand bottom corner over here. We can see that there is an icon showing that the dev tools are already here. When we click, we can see that the dev tools are open. So here we will see the list of all the queries that exist within the application. So there is only one query, the one that we [01:19] have just created, the employees list. When we click at the query, we can see what is its state. So in this case, this is a stale because the time has passed. We're going to speak about it in a while. And we can see what is the data over here, we can also trigger refreshing, we [01:39] can trigger invalidating, resetting and many other operations that we are going to look in in a while.

egghead
egghead
~ 19 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today