ContainerProvider component makes the Brandi container available to any nested components that need to use injections.
useInjection hook can then access the provided container via React's Context.
Container— the provider will not pass the orginal container, but its clone received from the
Container.clone()method (This can be useful together with using the container scope). This behavior is implemented so that the provider can safely extends the container with a container received from the upstream provider. In this way, we can implement a hierarchical DI system based on a hierarchy of React components.
boolean— as mentioned above, the provider extends the container with a container received from the upstream provider.
isolatedprop disables this behavior.
The container of this module will automatically access the root container from the previous example.
Thus the module components can request a dependency by
TOKENS.apiService token and get it from the parent container.