deno.land / x / jotai@v1.8.4 / src / utils / atomWithReducer.ts

atomWithReducer.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { 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}
jotai

Version Info

Tagged at
2 years ago