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

createKey.ts

11 lines282 Bytes

1let keyCount = 0
2​
3/**
4 * Creates a key that no other call returns, to use as a `queryKey` or
5 * `mutationKey` so tests don't share cache entries.
6 * @returns A new key like `['key-1']`.
7 */
8export const createKey = (): Array<string> => {
9 keyCount++
10 return [`key-${keyCount}`]