Options
All
  • Public
  • Public/Protected
  • All
Menu

Module index

Index

Start here Functions

Primary API Functions

Other Functions

Start here Functions

createStore

  • createStore<S, A>(initialState: S, logger?: Logger<S, A>): Store<S, A>
  • Create a Store for the State & Action types

    Type parameters

    Parameters

    • initialState: S

      Initial values of the state

    • logger: Logger<S, A> = ...

      The logging implementation (default provided)

    Returns Store<S, A>

Primary API Functions

Const createCompoundSelector

  • createCompoundSelector<S, B, A1, AN>(selectors: [Selector<S, A1>, ...LiftToSelector<S, AN>[]], fn: (...selectorResults: [A1, ...SelectorResults<LiftToSelector<S, AN>>[]]) => B, memoize?: Memoize): Selector<S, B>
  • Create a selector from numerous other selectors. Advised to use type inference over supplying these types.

    example
    const selectA: Selector<S, A>;
    const selectB: Selector<S, B>;
    const selectAB = createCompoundSelector(
        [selectA, selectB],
        (a, b) => ...)
    );
    

    Type parameters

    • S

      State type

    • B

      Return type

    • A1

      The return type of the first selector in the given selectors array

    • AN: any[]

      The tuple of return types for the remaining selectors

    Parameters

    • selectors: [Selector<S, A1>, ...LiftToSelector<S, AN>[]]

      Selectors whom results shall be passed to fn

    • fn: (...selectorResults: [A1, ...SelectorResults<LiftToSelector<S, AN>>[]]) => B

      Take the results of the given the selectors and return some value B

        • (...selectorResults: [A1, ...SelectorResults<LiftToSelector<S, AN>>[]]): B
        • Parameters

          • Rest ...selectorResults: [A1, ...SelectorResults<LiftToSelector<S, AN>>[]]

          Returns B

    • memoize: Memoize = ...

      Defaulted: Memoize implementation

    Returns Selector<S, B>

Const createSelector

  • Memoized function from S to A

    example
    const selectFoo = createSelector<{foo: boolean}, boolean>(state => state.foo);
    

    Type parameters

    • S

      State type

    • A

      Result type

    Parameters

    • fn: (s: S) => A

      Create an A from S

        • (s: S): A
        • Parameters

          • s: S

          Returns A

    • memoize: Memoize = ...

      Defaulted: Memoize implementation

    Returns Selector<S, A>

Const reducerFromHandlers

  • Create a reducer by specifing reducer-per-action-type

    example
    const myReducer = reducerFromHandlers<MyState, MyAction>({
        myAction1: (state, action1) => state,
        myAction2: (state, action2) => state,
    });
    

    Type parameters

    • S

      State type

    • A: Action

      Action type

    Parameters

    Returns Reducer<S, A>

Other Functions

Const createInquirierHooks

Generated using TypeDoc