makeStateKey

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

查看"说明"...

makeStateKey<T = void>(key: string): StateKey<T>
      
      makeStateKey<T = void>(key: string): StateKey<T>
    
参数
key string
返回值

StateKey<T>

说明

Example:

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

transferState.set(COUNTER_KEY, value);