---
title: "Discussion on \"Wtf is dependency injection? (JavaScript edition)\" | Hashnode"
description: "Discussion on \"Wtf is dependency injection? (JavaScript edition)\". You might be using it already."
url: "https://hashnode.com/posts/wtf-is-dependency-injection-javascript-edition/654a7afc9bd342528787b32e"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Wtf is dependency injection? (JavaScript edition)](https://tigerabrodi.blog/wtf-is-dependency-injection-javascript-edition?utm_source=hashnode&utm_medium=feed)

You might be using it already.

Nov 7, 2023 · 3 min read · tigerabrodi.blog  
Read the article

-   [#design-patterns](https://hashnode.com/tag/design-patterns)
-   [#programming](https://hashnode.com/tag/programming)
-   [#software-development](https://hashnode.com/tag/software-development)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[Tiger Abrodi](https://hashnode.com/@tigerabrodi)

@tigerabrodi · Germany

  
[View profile](https://hashnode.com/@tigerabrodi)

Obsessed with crafting software.

Just a guy who loves to write code and watch anime.

## Responses 5

Markdown supported · ⌘↵ to post

[shubham garje](https://hashnode.com/@srgarje99)

[Nov 28, 2023](https://hashnode.com/posts/wtf-is-dependency-injection-javascript-edition/654a7afc9bd342528787b32e/comment/656590a64628c2732a769036)

you made it simple AF!!

[Wordpress training London](https://hashnode.com/@wordpresstraininginl)

[Nov 18, 2023](https://hashnode.com/posts/wtf-is-dependency-injection-javascript-edition/654a7afc9bd342528787b32e/comment/65584dcfc808315676f4b4aa)

Unlike what others may have mentioned, Dependency Injection is a method that enables you to supply an object from your app's root, making it accessible anywhere you need it in your app. Before this, we had to pass items like Props from the root down through each level of children, which could be cumbersome. With DI, you simply pass the Prop or Object to the Provider, assigning it a name. Later, if you're several levels down and need something from the Provider, you just call Inject with the designated name, and there you have it. This mechanism is incredibly useful. Vue.js has a great implementation of this, and it's common in other modern systems too.

[Site OKVIP](https://hashnode.com/@Okvipsite)

[Nov 15, 2023](https://hashnode.com/posts/wtf-is-dependency-injection-javascript-edition/654a7afc9bd342528787b32e/comment/65546fc11ad51639886af261)

OKVIP không chỉ là một trang liên minh với các nhà cái uy tín hàng đầu thế giới trong lĩnh vực game online, mà còn là một nơi đầy tâm huyết, đã nắm bắt tầm quan trọng của trách nhiệm xã hội [okvip.site/trang-jun88](https://okvip.site/trang-jun88/) [okvip.site/cac-hoat-dong-tu-thien](https://okvip.site/cac-hoat-dong-tu-thien/) [okvip.site/nha-cai-f8bet](https://okvip.site/nha-cai-f8bet/) [okvip.site/nha-cai-789bet](https://okvip.site/nha-cai-789bet/) [okvip.site/nhan-su](https://okvip.site/nhan-su/) [okvip.site/thiet-ke-hinh-anh](https://okvip.site/thiet-ke-hinh-anh/)

[Ken Kopelson](https://hashnode.com/@kenbkop)

[Nov 14, 2023](https://hashnode.com/posts/wtf-is-dependency-injection-javascript-edition/654a7afc9bd342528787b32e/comment/6553508c7d42152f2f1917df)

Contrary to what others have said, Dependency Injection is a mechanism that allows you to Provide an object from the root of your app, and then you can Inject it anywhere in your app that you need. Without this, we had to pass things like Props from the root, to its children, then to those children's children, etc., until the Prop arrived at the place where we wanted to use it. With DI, you just pass the Prop, Object, or whatever to the Provider, giving it a name string. Then, let's say you are 5 levels down in your component hierarchy, and you want one of the things you gave to the Provider. You just call Inject, giving it the name of the thing you want, and there it is. This mechanism is VERY handy. Vue.js provided a great implementation of this, but so do most other modern systems.

[Bogdan Vladoiu](https://hashnode.com/@count7ero)

[Nov 13, 2023](https://hashnode.com/posts/wtf-is-dependency-injection-javascript-edition/654a7afc9bd342528787b32e/comment/65518034b114e923524de410)

In Android dependency injection is a scam employed to sell more development hours. Why do manual dependency injection especially in a language that has lazy and lateinit, when you can employ a framework not tailored to your needs and fight with it and bill more hours. I am not a js developer but it seems you are advocating manual dependency injection that i also rezonate with
