Question about avoiding relying on an event bus by using provide/inject #13005
-
Hello there! Reading through https://v3-migration.vuejs.org/breaking-changes/events-api#event-bus it is stated at the end that using an event bus is usually discouraged and can be avoided with:
Although I do see how this can help avoid props drilling I don’t see how this fixes the need for an event bus. If one want to stick to the one way data flow of props, the children still might need to advertise events for the provider to react to. How does Provide/Inject allow the "injected" component to call back the provider for events without having to manually bubble events through the whole stack ? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can provide a function that can then be called by the injecting component. |
Beta Was this translation helpful? Give feedback.
You can provide a function that can then be called by the injecting component.