WritableAtom <T>
Hierarchy
- DestroyableAtom<T>
- WritableAtom
Callable
Returns T
Index
Properties
Methods
Properties
readonlyonDestroyed
Signals that the AtomEffect
has been destroyed
Methods
asReadonly
Returns a readonly version of this atom. Readonly atom can be accessed to read their value but can't be changed using set, update or mutate methods.
Returns Atom<T>
destroy
Destroys the atom, notifies any dependents and calls
onDestroy
callback.Returns void
mutate
Update the current value by mutating it in-place, and unconditionally notify any dependents.
Parameters
mutatorFn: (value: T) => void
Returns void
set
Directly set the atom to a new value, and notify any dependents.
Parameters
value: T
Returns boolean
update
Update the value of the atom based on its current value, and notify any dependents.
Parameters
updateFn: (value: T) => T
Returns boolean
A writable
Atom
with a value that can be mutated via a setter interface.