Callback function type for mutator operations.
This function receives the current cached data and can return new data to update the cache. It can be synchronous or asynchronous, and can return undefined to indicate no change should be made.
The type of the cached data
Optional
The current data in the cache (may be undefined)
New data to set, undefined for no change, or a Promise resolving to either
// Increment a countermutate(key, (current: number = 0) => current + 1)// Async updatemutate(key, async (current) => { const updated = await updateData(current) return updated}) Copy
// Increment a countermutate(key, (current: number = 0) => current + 1)// Async updatemutate(key, async (current) => { const updated = await updateData(current) return updated})
Callback function type for mutator operations.
This function receives the current cached data and can return new data to update the cache. It can be synchronous or asynchronous, and can return undefined to indicate no change should be made.