deno.land / x / jotai@v1.8.4 / src / utils / atomWithReducer.ts
1234567891011121314151617181920212223import { atom } from 'jotai'import type { WritableAtom } from 'jotai'
export function atomWithReducer<Value, Action>( initialValue: Value, reducer: (value: Value, action?: Action) => Value): WritableAtom<Value, Action | undefined>
export function atomWithReducer<Value, Action>( initialValue: Value, reducer: (value: Value, action: Action) => Value): WritableAtom<Value, Action>
export function atomWithReducer<Value, Action>( initialValue: Value, reducer: (value: Value, action: Action) => Value) { const anAtom: any = atom(initialValue, (get, set, action: Action) => set(anAtom, reducer(get(anAtom), action)) ) return anAtom}
Version Info