@statesync/jotai / JotaiStoreLike
Interface: JotaiStoreLike<State, Atom>
Defined in: jotai.ts:15
Minimal structural interface that a Jotai store satisfies.
We intentionally avoid importing jotai types here so this adapter stays dependency-free and can be used in environments where the jotai package is not installed. Any object that structurally matches this interface — including a real store from createStore() — can be passed to createJotaiSnapshotApplier.
Type Parameters
| Type Parameter | Description |
|---|---|
State | The value type held by the target atom. |
Atom | The atom reference type (opaque to the adapter). |
Methods
get()
get(atom): State;Defined in: jotai.ts:25
Returns the current value of the given atom.
Used in 'replace' mode to read existing state so that keys excluded by omitKeys can be preserved.
Parameters
| Parameter | Type | Description |
|---|---|---|
atom | Atom | The atom to read. |
Returns
State
The current value of the atom.
set()
set(atom, value): void;Defined in: jotai.ts:37
Sets the atom's value. Accepts either a direct value or an updater function that receives the previous value and returns the next value.
The adapter uses the updater form for atomic read-modify-write operations (patch mode and replace mode with omitKeys).
Parameters
| Parameter | Type | Description |
|---|---|---|
atom | Atom | The atom to write. |
value | State | (prev) => State | The next value, or an updater function (prev) => next. |
Returns
void
