openmrs-esm-core

O3 Framework / createGlobalStore

Function: createGlobalStore()

createGlobalStore<T>(name, initialState, storageType): StoreApi<T>

Defined in: packages/framework/esm-state/src/state.ts:35

Creates a Zustand store.

Type Parameters

T

T

Parameters

name

string

A name by which the store can be looked up later. Must be unique across the entire application.

initialState

T

An object which will be the initial state of the store.

storageType

StorageType = 'none'

The type of storage to use for persisting the store’s state. Defaults to ‘none’.

Returns

StoreApi<T>

The newly created store.