D Dependency Inversion Principle DIP
3 sectionsRapid overview
Dependency Inversion Principle (DIP)
TL;DR
DIP says high-level code (components, use-cases) should depend on abstractions, not on the concrete classes that implement them. Injecting a StorageService interface instead of new LocalStorageService() is what makes the component swap to sā¦
Read āHow it works
> "High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions."
Read āQuick recall Q&A
Q: How does DIP differ from simple dependency injection in React? A: DIP is the principle (depend on abstractions). Dependency injection is a technique to supply those abstractions at runtime. You can inject dependencies via props, hooks, oā¦
Read ā