Skip to content

Migration guide: Suggest $emit() as replacement for $dispatch() when used /wparent and a direct child #455

Closed
@LinusBorg

Description

@LinusBorg

This section covers the deprecation of $dispatch() and $broadcast():

https://vuejs.org/guide/migration.html#dispatch-and-broadcast-deprecated

The way it is currently worded, it makes it seem that for every instance of $dispatch(), the only solution is an event bus.

But actually, in my experience, many people use $dispatch() to communicate bewteen a parent and its direct children as well (and many often don't event know about the $emit('event') <-> @event="callback" method).

So to improve this, we should mention that in cases were $dispatch () is used between a child and its direct parent, it should be replaced with $emit() and a listener in the parent template rather than an event bus.

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