Closed
Description
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.