# Disabling Queries

> 

> [!WARNING] Deprecated
> The classic React Query integration (`@trpc/react-query`) only gets bug fixes, and will be removed in the next major version of tRPC. New projects should use the [TanStack React Query integration](https://trpc.io/docs/client/tanstack-react-query.md) (`@trpc/tanstack-react-query`). To move an existing project, follow the [migration guide](https://trpc.io/docs/client/tanstack-react-query/migrating.md).


To disable queries, you can pass `skipToken` as the first argument to `useQuery`, `useInfiniteQuery`, and `useSubscription`. This will prevent the query from being executed.

### Typesafe conditional queries using `skipToken`

```tsx
import React, { useState } from 'react';
import { skipToken } from '@tanstack/react-query';
import { trpc } from './utils/trpc';

export function MyComponent() {
  const [name, setName] = useState<string | undefined>();

  const result = trpc.getUserByName.useQuery(name ? { name: name } : skipToken);

  return (
    <div>{result.data?.name}</div>
  );
}
```
