@laserware/stasis
    Preparing search index...

    Type Alias Reducer<S, A, PreloadedState>

    Reducer: (state: S | PreloadedState | undefined, action: A) => S

    A reducer 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.

    Type Parameters

    • S = any

      The type of state consumed and produced by this reducer.

    • A extends Action = UnknownAction

      The type of actions the reducer can potentially respond to.

    • PreloadedState = S

      The type of state consumed by this reducer the first time it's called.

    Type declaration