Design Patterns · Middle · Question 50 of 75
How does a DI container (Angular, InversifyJS) differ from passing dependencies by hand?
- ✓Correct answer: The container creates objects and resolves the dependency graph from configuration
- 2The container forbids passing dependencies through the constructor
- 3The container works only with singletons and can't create new objects
Explanation
The container registers providers and, on request, assembles an object with all its dependencies, managing lifetimes (singleton, per request, per component). React projects usually make do with Context and factories, without a container.