A deep dive into the Liskov Substitution Principle with examples, violations, and practical tips for writing scalable, bug-free object-oriented code.
This article walks through new CSS features like ::scroll-button()
and ::scroll-marker()
that make it possible to build fully functional CSS-only carousels.
Let’s talk about one of the greatest problems in software development: nascent developers bouncing off grouchy superiors into the arms of AI.
Flexbox and Grid are the heart of modern CSS layouts. Learn when to use each and how they help build flexible, responsive web designs — no more hacks or guesswork.
6 Replies to "Dependency injection in Vue: Advantages and caveats"
Hey! Vue provide variables can be reactive with vue3 composition api. The ref method activate this ability.
Thanks Ismail.
Why would you need to inject dependencies when you have Vuex? The prop drilling example is easily mitigated with state management.
While Vuex can mitigate prop drilling, it is worth noting that it can be an overkill and added complexity for small to medium Vuejs applications.
With dependency injection, DurryComponent would receive the wallet from RexComponent without passing through TomComponent and PeterComponent.
Actually no. The dependency will traverse the entire descendant tree and will be available to any nested components. That’s the main problem with vue di. You can’t control the di process.
Hi Predi, actually that illustration was a quick comparison between dependency injection and prop drilling. With DI we don’t have to pass the values manually like we do with props. I will provide some updates for more clarity. Thanks!