Type Alias Store<TState, TActions>

Store: {
    actions: TActions;
    get: () => TState;
    set: (stateModifier: StateModifier<TState>) => TState;
    subscribe: (listener: Listener) => Listener;
}

Type Parameters

  • TState extends object
  • TActions extends object

Type declaration

  • actions: TActions

    Actions that can modify the state of the store.

  • get: () => TState

    Returns the current state of the store.

  • set: (stateModifier: StateModifier<TState>) => TState

    Sets the state of the store.

  • subscribe: (listener: Listener) => Listener

    Subscribes to changes in the state of the store. Returns an unsubscribe function.