Summary
Throughout this chapter, we have looked at global composition patterns and advanced component setups that can be used to reduce duplication throughout a Vue.js application.
First, we learned about mixins, which explicitly share functionality while letting components have the last say and saw the exceptions to this rule. We then saw how plugins are a great hook into multiple Vue.js primitives.
Next, we looked at how prescriptive patterns maximize component reusability in Vue.js. Ideas such as leveraging props to delegate data, slots to delegate templates, and implementing interfaces that allow components to be used with Vue-idiomatic shorthand such as v-model
were shown.
We also took an in-depth look at what Vue.js components are beyond .vue
files. We delved into what a Vue.js component is by introducing string templates, render
functions, and JSX, as well as the requirements for each of these approaches to work. The component
tag and keep-alive
showed another...