© Adam Freeman 2018
Adam FreemanPro Vue.js 2https://doi.org/10.1007/978-1-4842-3805-9_18

18. Loosely Coupled Components

Adam Freeman1 
(1)
London, UK
 
As a Vue.js application grows, the need to pass data and events between parent and child components becomes harder to arrange, especially when components in different parts of the application need to communicate. The result can be components whose own functionality is overtaken by the need to pass on props for their descendants and relay events to their antecedents. In this chapter, I describe an alternative approach, known as dependency injection, which allows components to communicate without being tightly coupled to one another. I show you the different ways in which dependency injection can be used ...

Get Pro Vue.js 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.