2021-07-19
970
#vue
Emmanuel John
58675
Jul 19, 2021 â‹… 3 min read

Dependency injection in Vue: Advantages and caveats

Emmanuel John I'm a full-stack software developer, mentor, and writer. I am an open source enthusiast. In my spare time, I enjoy watching sci-fi movies and cheering for Arsenal FC.

Recent posts:

Styling HTML Details and Summary With Modern CSS

Styling HTML <details> and <summary> with modern CSS

Use CSS to style and manage disclosure widgets, which are the HTML `details` and `summary` elements.

Rob O'Leary
Dec 26, 2024 â‹… 11 min read
react native's new architecture: sync and async rendering

React Native’s New Architecture: Sync and async rendering

React Native’s New Architecture offers significant performance advantages. In this article, you’ll explore synchronous and asynchronous rendering in React Native through practical use cases.

Emmanuel John
Dec 24, 2024 â‹… 8 min read
Building a Full-Featured Laravel Admin Dashboard with Filament

Building a full-featured Laravel admin dashboard with Filament

Build scalable admin dashboards with Filament and Laravel using Form Builder, Notifications, and Actions for clean, interactive panels.

Kayode Adeniyi
Dec 20, 2024 â‹… 5 min read
Working With URLs In JavaScript

Working with URLs in JavaScript

Break down the parts of a URL and explore APIs for working with them in JavaScript, parsing them, building query strings, checking their validity, etc.

Joe Attardi
Dec 19, 2024 â‹… 6 min read
View all posts

6 Replies to "Dependency injection in Vue: Advantages and caveats"

  1. Why would you need to inject dependencies when you have Vuex? The prop drilling example is easily mitigated with state management.

    1. 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.

  2. 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.

    1. 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!

Leave a Reply