Skip to content

Specify initial value of reducer #105

Description

@klimashkin

Hello!

Sorry if it's been discussed or documented, but I could not find solution.
How to specify initial value of reducer in case of currying?

If on first @@redux/INIT run I don't do anything with draft, redux complains about returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state.. But if I do

some: produce((draft, action) => {
    if (draft === undefined) {
      return {};
    }
}

redux throw the same error...
Using version 1.1.0, and I though that returning object from producers should already work, strange.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions