# QueryKeySource

Defined in: [react/src/types.ts:691](https://github.com/B3Pay/ic-reactor/blob/f1956947ae037304fce1675a38695964c1aa9e32/packages/react/src/types.ts#L691)

Anything that knows the key of its queries: a query object from
`createQuery`, `createSuspenseQuery`, `createInfiniteQuery` or
`createSuspenseInfiniteQuery` (factory instances included), or a query
factory function, whose key covers every query it returns.

## Example

```typescript
const postsQuery = createQuery(backend, { functionName: "get_posts" })
const getPost = createQueryFactory(backend, { functionName: "get_post" })

// Both are key sources, so both go straight into invalidateQueries
createMutation(backend, {
  functionName: "create_post",
  invalidateQueries: [postsQuery, getPost],
})
```

## Properties

### getQueryKey

> **getQueryKey**: () => readonly `unknown`[]

Defined in: [react/src/types.ts:693](https://github.com/B3Pay/ic-reactor/blob/f1956947ae037304fce1675a38695964c1aa9e32/packages/react/src/types.ts#L693)

The key, or key prefix, of the queries it names.

#### Returns

readonly `unknown`[]

***

### invalidate?

> `optional` **invalidate?**: () => `Promise`\<`void`\>

Defined in: [react/src/types.ts:700](https://github.com/B3Pay/ic-reactor/blob/f1956947ae037304fce1675a38695964c1aa9e32/packages/react/src/types.ts#L700)

Invalidate those queries on the QueryClient they are cached in.
`invalidateQueries` calls it when it is there, so a query of another
reactor with a QueryClient of its own is invalidated in that client. The
key goes to the mutation's reactor's QueryClient otherwise.

#### Returns

`Promise`\<`void`\>