Skip to content

Mutation with newTask.id=responseData.id #23

Description

@StokeMasterJack

On line 77 in KanbanBoardContainer.addCard (chapter 5) you have:

newTask.id=responseData.id
this.setState({cards:nextState});

I noticed that you call setState with nextState before the ajax call. And you called setState with nextState after the ajax call. Isn't that mutating the deep state of nextState but returning the same pointer. In other words, why not use the "Immutability Helper update" method?

I thought that the whole reason for using "Immutability Helper update" was because you should't mutate the original object?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions