Skip to content

How to reset draft to initial state in reducer? #296

Description

@CodingPapi
const initialState = {
};
const reducer = produce((draft, action) => {
  switch (action.type) {
      case 'reset': {
          draft = initialState;
          break;
      }
}, initialState);

draft = initialState not work, how can we reset draft to initial state in convenient?

Thank you

Metadata

Metadata

Assignees

No one assigned

    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