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