Skip to content
0

katanakit-js / Updater

Type Alias: Updater<TInput, TOutput> ​

ts
type Updater<TInput, TOutput> = TOutput | ((input) => TOutput);

Defined in: node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/hydration-B9t5w6NC.d.ts:934

Either a plain value of type TOutput, or a function that receives TInput and returns TOutput. Used for example by setQueryData-style updaters, which accept either the new data directly or a function that computes it from the previous data. See functionalUpdate.

Type Parameters ​

Type Parameter
TInput
TOutput

Example ​

ts
queryClient.setQueryData(['posts'], newPosts)

// Or, using an updater function that receives the current data:
queryClient.setQueryData(['posts'], (oldPosts) =>
  oldPosts ? [...oldPosts, newPost] : oldPosts,
)

Released under the MIT License.