You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@tanstack/query-devtools

Package Overview
Dependencies
0
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/query-devtools

Developer tools to interact with and visualize the TanStack Query cache


Version published
Maintainers
2
Created

Package description

What is @tanstack/query-devtools?

@tanstack/query-devtools is a set of development tools for React Query (now part of TanStack Query). It provides a visual interface to inspect and debug queries, mutations, and cache in your application.

What are @tanstack/query-devtools's main functionalities?

Devtools UI

The Devtools UI provides a visual interface to inspect and debug queries and mutations. You can toggle it open and closed within your application.

import { ReactQueryDevtools } from '@tanstack/react-query-devtools';

function App() {
  return (
    <>
      <YourAppComponents />
      <ReactQueryDevtools initialIsOpen={false} />
    </>
  );
}

Inspect Queries

You can inspect the state of your queries, including their data, loading status, and errors. This helps in understanding the flow and state of data fetching in your application.

import { useQuery } from '@tanstack/react-query';

function Example() {
  const { data, error, isLoading } = useQuery(['todos'], fetchTodos);

  if (isLoading) return 'Loading...';
  if (error) return 'An error occurred';

  return (
    <div>
      {data.map(todo => (
        <div key={todo.id}>{todo.title}</div>
      ))}
    </div>
  );
}

Inspect Mutations

You can inspect the state of your mutations, including their data, loading status, and errors. This helps in understanding the flow and state of data mutations in your application.

import { useMutation } from '@tanstack/react-query';

function AddTodo() {
  const mutation = useMutation(newTodo => fetch('/api/todos', {
    method: 'POST',
    body: JSON.stringify(newTodo)
  }));

  return (
    <button
      onClick={() => {
        mutation.mutate({ title: 'New Todo' });
      }}
    >
      Add Todo
    </button>
  );
}

Other packages similar to @tanstack/query-devtools

FAQs

Package last updated on 12 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc