Skip to content

getTypescriptLibState<T>

Retrieves or creates a shared-state ValueWrapper for a given key.

Import:

import { getTypescriptLibState } from '@mnaoumov/typescript-lib/typescript-lib-state';

Signature:

function getTypescriptLibState(key: string, defaultValue: T): ValueWrapper<T>

Parameters:

Parameter Type Description
key string The key to store or retrieve the shared state under.
defaultValue T The default value to use if the shared state does not exist yet.

Returns: ValueWrapper<T> — The ValueWrapper that stores the shared state.