makeStateKey

Create a StateKey<T> that can be used to store value of type T with TransferState.

makeStateKey<T = void>(key: string): StateKey<T>

参数

key

Type: string.

返回值

StateKey<T>

说明

Example:

const COUNTER_KEY = makeStateKey<number>('counter'); let value = 10; transferState.set(COUNTER_KEY, value);