Overview
Typed factories live on the atom namespace (atom.number, atom.bool, atom.string, atom.array, atom.object). Each returns a normal atom plus domain methods that finish with an internal set/update so subscribers notify.
Pure read helpers (has, find, keys, isEmpty, …) do not notify — they only register a dependency when you also read the atom via () / .get() in a reactive context (or when a mutator already notified).
For keyed UI lists, stacks, queues, and native Map/Set, see Lists, stacks, maps.
Factory vs plain atom
|
API
|
Extra
|
Prefer when
|
|---|---|---|
atom(0)
| Core only | Fine when set/updater is enough. |
atom.number(0)
| incr / decr / clamp | Counters and clamped ranges. |
atom.array([])
| push / render / … | Lists with helpers; string id or index keys. |
atom.list([])
| Keyed rows | Dedicated leaf — unique readonly keys. |
number / bool / string
Small helpers for common scalar mutations — all notify like set().
array + object
Collection helpers + render(). addItem stamps id on plain objects when missing.