Skip to content

Lifecycle hooks/methods: Add note not to use arrow functions for them. #411

Closed
@LinusBorg

Description

@LinusBorg

Arrow functions don't work for hook functions and component methods because Vue can't use .bind() on them to bind them to the current vm instance, so this will be undefined

But people who don't know the mechanics of Vue here often miss this.

I see a question about this on the forum or in the github issues every week at the least.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions