Options
All
  • Public
  • Public/Protected
  • All
Menu

Module selectors

Index

Primary API Functions

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>

Generated using TypeDoc