Skip to main content

createState

function

Create a StateConfig for the given string key and StateValueConfig. The key must be locally unique. In dev you will get a key collision error when you use two separate StateConfig on the same node with the same key. The returned StateConfig value should be used with $getState and $setState.

function createState<K extends symbol | string, V>(key: K, valueConfig: StateValueConfig<V>): StateConfig<K, V>

Import

import { createState } from '@modular/sdk/editor';

Notes

returns
a StateConfig
__NO_SIDE_EFFECTS__