Skip to content

@statesync/jotai


@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 ParameterDescription
StateThe value type held by the target atom.
AtomThe atom reference type (opaque to the adapter).

Methods ​

get() ​

ts
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 ​

ParameterTypeDescription
atomAtomThe atom to read.

Returns ​

State

The current value of the atom.


set() ​

ts
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 ​

ParameterTypeDescription
atomAtomThe atom to write.
valueState | (prev) => StateThe next value, or an updater function (prev) => next.

Returns ​

void

Released under the MIT License.