Skip to main content

Function: createSharedStore()

function createSharedStore<S>(
name,
initial,
options?): SharedStore<S>;

State synced across every same-origin tab/window/worker: per-key last-writer-wins version clocks and a hello/snapshot late-joiner handshake. Create at most one store per name per tab (the React package memoizes).

Type Parameters

Type Parameter
S extends Record<string, unknown>

Parameters

ParameterType
namestring
initialS
options?SharedStoreOptions

Returns

SharedStore<S>