Skip to content

ch4 / KanbanBoardContainer.js - Two .bind() needed #4

@dxps

Description

@dxps

Hi Cássio,

A small update at the end of KanbanBoardContainer.js on chapter 4 is needed.
In cardCallbacks prop, only persistCardDrag contains .bind(this) at the end.

As such, moving a card will throw the standard error of 'cards is undefined', since the calling context is wrong. So, KanbanBoardContainer.js should end like this:

    render() {

        return ( <KanbanBoard
                      cards={this.state.cards}
                      taskCallbacks={{ ... }}
                      cardCallbacks={{
                        updateStatus: this.updateCardStatus.bind(this),
                        updatePosition: this.updateCardPosition.bind(this),
                        persistCardDrag: this.persistCardDrag.bind(this)
                      }}
                  />
        )
    }

}

export default KanbanBoardContainer;

Last, but not least, thank you very much for the book! :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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