> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modelence.com/llms.txt
> Use this file to discover all available pages before exploring further.

# createQueryKey

[API Reference](https://docs.modelence.com/api-reference/@modelence/react-query/functions/../../../index) / [@modelence/react-query](https://docs.modelence.com/api-reference/@modelence/react-query/functions/../index) / createQueryKey

> **createQueryKey**\<`T`, `U`>(`methodName`, `args`): [`ModelenceQueryKey`](https://docs.modelence.com/api-reference/@modelence/react-query/functions/../type-aliases/ModelenceQueryKey)\<`T`, `U`>

Defined in: [index.ts:279](https://github.com/modelence/modelence/blob/main/packages/react-query/src/index.ts#L279)

Utility function to create query keys for manual cache operations

## Example

```tsx theme={null}
import { useQueryClient } from '@tanstack/react-query';
import { createQueryKey } from '@modelence/react-query';

function TodoActions() {
  const queryClient = useQueryClient();
  
  const refreshTodos = () => {
    queryClient.invalidateQueries({ 
      queryKey: createQueryKey('todo.getAll', { limit: 10 }) 
    });
  };
}
```

## Type Parameters

| Type Parameter | Default type |
| - | - |
| `T` *extends* `string` | - |
| `U` *extends* `Args` | `Args` |

## Parameters

| Parameter | Type | Description |
| - | - | - |
| `methodName` | `T` | The method name |
| `args` | `U` | The arguments |

## Returns

[`ModelenceQueryKey`](https://docs.modelence.com/api-reference/@modelence/react-query/functions/../type-aliases/ModelenceQueryKey)\<`T`, `U`>

Typed query key


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.