Mixins and pure functions
Sometimes, you'll face situations where an existing component almost fits your new requirements but not quite. Some other times, you'll notice that different components actually have quite a lot in common, but also diverge too much in some respects.
Application design choices are often very situational, and there aren't many solutions that you can blindly apply, no matter what. For example, splitting components means introducing some level of duplication and breaking the DRY principle, while extending or combining existing components can lead to bloat (for example, too many properties on a single component) or introduce leaky abstractions and more trouble down the line.
Vue.js mixins (not to be confused with TypeScript ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access