Configure React Query Devtools and inspect existing queries

Tomasz Ducin
InstructorTomasz Ducin
Share this video with your friends

Social Share Links

Send Tweet
Published 7 months ago
Updated 2 months 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.