Open History to see the last commit
1---
2id: hashKey
3title: hashKey
4---
5β
6```ts
7function hashKey(queryKey: readonly unknown[]): string;
8```
9β
10Defined in: [packages/query-core/src/utils.ts:323](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L323)
11β
12Default query & mutation keys hash function.
13Hashes the value into a stable hash.
14β
15## Parameters
16β
17### queryKey
18β
19readonly `unknown`[]
20β
21The query or mutation key to hash.
22β
23## Returns
24β
25`string`
26β
27The stable hash of the key, as a JSON string.
28β
29## Example
30β
31```ts
32// Object keys are sorted, so key order doesn't affect the hash:
33hashKey(['todos', { page: 1, filter: 'done' }]) // === '["todos",{"filter":"done","page":1}]'
34```