Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "node_modules/redux/index.d"

Index

Type aliases

DeepPartial

DeepPartial: object

Type declaration

Func0

Func0: function

Type declaration

    • (): R
    • Returns R

Func1

Func1: function

Type declaration

    • (a1: T1): R
    • Parameters

      • a1: T1

      Returns R

Func2

Func2: function

Type declaration

    • (a1: T1, a2: T2): R
    • Parameters

      • a1: T1
      • a2: T2

      Returns R

Func3

Func3: function

Type declaration

    • (a1: T1, a2: T2, a3: T3, ...args: any[]): R
    • Parameters

      • a1: T1
      • a2: T2
      • a3: T3
      • Rest ...args: any[]

      Returns R

Reducer

Reducer: function

A reducer (also called a reducing function) is a function that accepts an accumulation and a value and returns a new accumulation. They are used to reduce a collection of values down to a single value

Reducers are not unique to Redux—they are a fundamental concept in functional programming. Even most non-functional languages, like JavaScript, have a built-in API for reducing. In JavaScript, it's Array.prototype.reduce().

In Redux, the accumulated value is the state object, and the values being accumulated are actions. Reducers calculate a new state given the previous state and an action. They must be pure functions—functions that return the exact same output for given inputs. They should also be free of side-effects. This is what enables exciting features like hot reloading and time travel.

Reducers are the most important concept in Redux.

Do not put API calls into reducers.

template

S The type of state consumed and produced by this reducer.

template

A The type of actions the reducer can potentially respond to.

Type declaration

    • (state: S | undefined, action: A): S
    • Parameters

      • state: S | undefined
      • action: A

      Returns S

ReducersMapObject

ReducersMapObject: object

Object whose values correspond to different reducer functions.

template

A The type of actions the reducers can potentially respond to.

Type declaration

StoreEnhancer

StoreEnhancer: function

A store enhancer is a higher-order function that composes a store creator to return a new, enhanced store creator. This is similar to middleware in that it allows you to alter the store interface in a composable way.

Store enhancers are much the same concept as higher-order components in React, which are also occasionally called “component enhancers”.

Because a store is not an instance, but rather a plain-object collection of functions, copies can be easily created and modified without mutating the original store. There is an example in compose documentation demonstrating that.

Most likely you'll never write a store enhancer, but you may use the one provided by the developer tools. It is what makes time travel possible without the app being aware it is happening. Amusingly, the Redux middleware implementation is itself a store enhancer.

template

Ext Store extension that is mixed into the Store type.

template

StateExt State extension that is mixed into the state type.

Type declaration

StoreEnhancerStoreCreator

StoreEnhancerStoreCreator: function

Type declaration

Variables

Const createStore

createStore: StoreCreator

Creates a Redux store that holds the state tree. The only way to change the data in the store is to call dispatch() on it.

There should only be a single store in your app. To specify how different parts of the state tree respond to actions, you may combine several reducers into a single reducer function by using combineReducers.

template

S State object type.

param

A function that returns the next state tree, given the current state tree and the action to handle.

param

initial state. You may optionally specify it to hydrate the state from the server in universal apps, or to restore a previously serialized user session. If you use combineReducers to produce the root reducer function, this must be an object with the same shape as combineReducers keys.

param

store enhancer. You may optionally specify it to enhance the store with third-party capabilities such as middleware, time travel, persistence, etc. The only store enhancer that ships with Redux is applyMiddleware().

returns

A Redux store that lets you read the state, dispatch actions and subscribe to changes.

Functions

applyMiddleware

  • Creates a store enhancer that applies middleware to the dispatch method of the Redux store. This is handy for a variety of tasks, such as expressing asynchronous actions in a concise manner, or logging every action payload.

    See redux-thunk package as an example of the Redux middleware.

    Because middleware is potentially asynchronous, this should be the first store enhancer in the composition chain.

    Note that each middleware will be given the dispatch and getState functions as named arguments.

    template

    Ext Dispatch signature added by a middleware.

    template

    S The type of the state supported by a middleware.

    Returns StoreEnhancer

    A store enhancer applying the middleware.

  • Type parameters

    • Ext1

    • S

    Parameters

    Returns StoreEnhancer<object>

  • Type parameters

    • Ext1

    • Ext2

    • S

    Parameters

    Returns StoreEnhancer<object>

  • Type parameters

    • Ext1

    • Ext2

    • Ext3

    • S

    Parameters

    Returns StoreEnhancer<object>

  • Type parameters

    • Ext1

    • Ext2

    • Ext3

    • Ext4

    • S

    Parameters

    Returns StoreEnhancer<object>

  • Type parameters

    • Ext1

    • Ext2

    • Ext3

    • Ext4

    • Ext5

    • S

    Parameters

    Returns StoreEnhancer<object>

  • Type parameters

    • Ext

    • S

    Parameters

    Returns StoreEnhancer<object>

bindActionCreators

  • bindActionCreators<A, C>(actionCreator: C, dispatch: Dispatch): C
  • bindActionCreators<A, B>(actionCreator: A, dispatch: Dispatch): B
  • bindActionCreators<A, M>(actionCreators: M, dispatch: Dispatch): M
  • bindActionCreators<M, N>(actionCreators: M, dispatch: Dispatch): N
  • Turns an object whose values are action creators, into an object with the same keys, but with every function wrapped into a dispatch call so they may be invoked directly. This is just a convenience method, as you can call store.dispatch(MyActionCreators.doSomething()) yourself just fine.

    For convenience, you can also pass a single function as the first argument, and get a function in return.

    Type parameters

    Parameters

    • actionCreator: C

      An object whose values are action creator functions. One handy way to obtain it is to use ES6 import * as syntax. You may also pass a single function.

    • dispatch: Dispatch

      The dispatch function available on your Redux store.

    Returns C

    The object mimicking the original object, but with every action creator wrapped into the dispatch call. If you passed a function as actionCreator, the return value will also be a single function.

  • Type parameters

    Parameters

    Returns B

  • Type parameters

    Parameters

    Returns M

  • Type parameters

    Parameters

    Returns N

combineReducers

  • Turns an object whose values are different reducer functions, into a single reducer function. It will call every child reducer, and gather their results into a single state object, whose keys correspond to the keys of the passed reducer functions.

    template

    S Combined state object type.

    Type parameters

    • S

    Parameters

    • reducers: ReducersMapObject<S, any>

      An object whose values correspond to different reducer functions that need to be combined into one. One handy way to obtain it is to use ES6 import * as reducers syntax. The reducers may never return undefined for any action. Instead, they should return their initial state if the state passed to them was undefined, and the current state for any unrecognized action.

    Returns Reducer<S>

    A reducer function that invokes every reducer inside the passed object, and builds a state object with the same shape.

  • Type parameters

    Parameters

    Returns Reducer<S, A>

compose

  • compose(): function
  • compose<F>(f: F): F
  • compose<A, R>(f1: function, f2: Func0<A>): Func0<R>
  • compose<A, T1, R>(f1: function, f2: Func1<T1, A>): Func1<T1, R>
  • compose<A, T1, T2, R>(f1: function, f2: Func2<T1, T2, A>): Func2<T1, T2, R>
  • compose<A, T1, T2, T3, R>(f1: function, f2: Func3<T1, T2, T3, A>): Func3<T1, T2, T3, R>
  • compose<A, B, R>(f1: function, f2: function, f3: Func0<A>): Func0<R>
  • compose<A, B, T1, R>(f1: function, f2: function, f3: Func1<T1, A>): Func1<T1, R>
  • compose<A, B, T1, T2, R>(f1: function, f2: function, f3: Func2<T1, T2, A>): Func2<T1, T2, R>
  • compose<A, B, T1, T2, T3, R>(f1: function, f2: function, f3: Func3<T1, T2, T3, A>): Func3<T1, T2, T3, R>
  • compose<A, B, C, R>(f1: function, f2: function, f3: function, f4: Func0<A>): Func0<R>
  • compose<A, B, C, T1, R>(f1: function, f2: function, f3: function, f4: Func1<T1, A>): Func1<T1, R>
  • compose<A, B, C, T1, T2, R>(f1: function, f2: function, f3: function, f4: Func2<T1, T2, A>): Func2<T1, T2, R>
  • compose<A, B, C, T1, T2, T3, R>(f1: function, f2: function, f3: function, f4: Func3<T1, T2, T3, A>): Func3<T1, T2, T3, R>
  • compose<R>(f1: function, ...funcs: Function[]): function
  • compose<R>(...funcs: Function[]): function
  • Composes single-argument functions from right to left. The rightmost function can take multiple arguments as it provides the signature for the resulting composite function.

    Returns function

    R function obtained by composing the argument functions from right to left. For example, compose(f, g, h) is identical to doing (...args) => f(g(h(...args))).

      • <R>(a: R): R
      • Type parameters

        • R

        Parameters

        • a: R

        Returns R

  • Type parameters

    • F: Function

    Parameters

    • f: F

    Returns F

  • Type parameters

    • A

    • R

    Parameters

    • f1: function
        • (b: A): R
        • Parameters

          • b: A

          Returns R

    • f2: Func0<A>

    Returns Func0<R>

  • Type parameters

    • A

    • T1

    • R

    Parameters

    • f1: function
        • (b: A): R
        • Parameters

          • b: A

          Returns R

    • f2: Func1<T1, A>

    Returns Func1<T1, R>

  • Type parameters

    • A

    • T1

    • T2

    • R

    Parameters

    • f1: function
        • (b: A): R
        • Parameters

          • b: A

          Returns R

    • f2: Func2<T1, T2, A>

    Returns Func2<T1, T2, R>

  • Type parameters

    • A

    • T1

    • T2

    • T3

    • R

    Parameters

    • f1: function
        • (b: A): R
        • Parameters

          • b: A

          Returns R

    • f2: Func3<T1, T2, T3, A>

    Returns Func3<T1, T2, T3, R>

  • Type parameters

    • A

    • B

    • R

    Parameters

    • f1: function
        • (b: B): R
        • Parameters

          • b: B

          Returns R

    • f2: function
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f3: Func0<A>

    Returns Func0<R>

  • Type parameters

    • A

    • B

    • T1

    • R

    Parameters

    • f1: function
        • (b: B): R
        • Parameters

          • b: B

          Returns R

    • f2: function
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f3: Func1<T1, A>

    Returns Func1<T1, R>

  • Type parameters

    • A

    • B

    • T1

    • T2

    • R

    Parameters

    • f1: function
        • (b: B): R
        • Parameters

          • b: B

          Returns R

    • f2: function
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f3: Func2<T1, T2, A>

    Returns Func2<T1, T2, R>

  • Type parameters

    • A

    • B

    • T1

    • T2

    • T3

    • R

    Parameters

    • f1: function
        • (b: B): R
        • Parameters

          • b: B

          Returns R

    • f2: function
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f3: Func3<T1, T2, T3, A>

    Returns Func3<T1, T2, T3, R>

  • Type parameters

    • A

    • B

    • C

    • R

    Parameters

    • f1: function
        • (b: C): R
        • Parameters

          • b: C

          Returns R

    • f2: function
        • (a: B): C
        • Parameters

          • a: B

          Returns C

    • f3: function
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f4: Func0<A>

    Returns Func0<R>

  • Type parameters

    • A

    • B

    • C

    • T1

    • R

    Parameters

    • f1: function
        • (b: C): R
        • Parameters

          • b: C

          Returns R

    • f2: function
        • (a: B): C
        • Parameters

          • a: B

          Returns C

    • f3: function
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f4: Func1<T1, A>

    Returns Func1<T1, R>

  • Type parameters

    • A

    • B

    • C

    • T1

    • T2

    • R

    Parameters

    • f1: function
        • (b: C): R
        • Parameters

          • b: C

          Returns R

    • f2: function
        • (a: B): C
        • Parameters

          • a: B

          Returns C

    • f3: function
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f4: Func2<T1, T2, A>

    Returns Func2<T1, T2, R>

  • Type parameters

    • A

    • B

    • C

    • T1

    • T2

    • T3

    • R

    Parameters

    • f1: function
        • (b: C): R
        • Parameters

          • b: C

          Returns R

    • f2: function
        • (a: B): C
        • Parameters

          • a: B

          Returns C

    • f3: function
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f4: Func3<T1, T2, T3, A>

    Returns Func3<T1, T2, T3, R>

  • Type parameters

    • R

    Parameters

    • f1: function
        • (b: any): R
        • Parameters

          • b: any

          Returns R

    • Rest ...funcs: Function[]

    Returns function

      • (...args: any[]): R
      • Parameters

        • Rest ...args: any[]

        Returns R

  • Type parameters

    • R

    Parameters

    • Rest ...funcs: Function[]

    Returns function

      • (...args: any[]): R
      • Parameters

        • Rest ...args: any[]

        Returns R

Generated using TypeDoc