Interface ActionCreatorFactory

interface ActionCreatorFactory {
    async<Params, Result, Error>(type, commonMeta?): AsyncActionCreators<Params, Result, Error>;
    <Payload>(type, commonMeta?, isError?): ActionCreator<Payload>;
    <Payload>(type, commonMeta?, isError?): ActionCreator<Payload>;
}
  • Creates Action Creator that produces actions with given type and payload of type Payload.

    Type Parameters

    • Payload = void

    Parameters

    • type: string

      Type of created actions.

    • Optional commonMeta: Meta

      Metadata added to created actions.

    • Optional isError: boolean

      Defines whether created actions are error actions.

    Returns ActionCreator<Payload>

  • Creates Action Creator that produces actions with given type and payload of type Payload.

    Type Parameters

    • Payload = void

    Parameters

    • type: string

      Type of created actions.

    • Optional commonMeta: Meta

      Metadata added to created actions.

    • Optional isError: ((payload) => boolean)

      Function that detects whether action is error given the payload.

        • (payload): boolean
        • Parameters

          Returns boolean

    Returns ActionCreator<Payload>

Methods

Methods

  • Creates three Action Creators:

    • started: ActionCreator<Params>
    • done: ActionCreator<{params: Params, result: Result}>
    • failed: ActionCreator<{params: Params, error: Error}>

    Useful to wrap asynchronous processes.

    Type Parameters

    • Params
    • Result
    • Error = {}

    Parameters

    • type: string

      Prefix for types of created actions, which will have types ${type}_STARTED, ${type}_DONE and ${type}_FAILED.

    • Optional commonMeta: Meta

      Metadata added to created actions.

    Returns AsyncActionCreators<Params, Result, Error>