Skip to main content
Version: 3.11

useState

Callable

  • useState<State>(name?: string, defaultValue?: State, options?: UseStateOptions): Promise<State>

  • Easily create and manage state values. All state values are automatically persisted.

    Values can be modified by simply using the assignment operator.


    Type parameters

    • State: Dictionary = Dictionary

    Parameters

    • optionalname: string

      The name of the store to use.

    • defaultValue: State = ...

      If the store does not yet have a value in it, the value will be initialized with the defaultValue you provide.

    • optionaloptions: UseStateOptions

      An optional object parameter where a custom keyValueStoreName and config can be passed in.

    Returns Promise<State>