Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

hashKey.md

30 lines500 Bytes

1---
2id: hashKey
3title: hashKey
4---
5​
6```ts
7function hashKey(queryKey: readonly unknown[]): string;
8```
9​
10Defined in: packages/query-core/dist-ts/src/utils.d.ts:133
11​
12Default query & mutation keys hash function.
13Hashes the value into a stable hash.
14​
15## Parameters
16​
17### queryKey
18​
19readonly `unknown`[]
20​
21## Returns
22​
23`string`
24​
25## Example
26​
27```ts
28// Object keys are sorted, so key order doesn't affect the hash:
29hashKey(['todos', { page: 1, filter: 'done' }]) // === '["todos",{"filter":"done","page":1}]'
30```