Skip to content

Mutation with newTask.id=responseData.id #23

@StokeMasterJack

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?

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