September 2018
Intermediate to advanced
302 pages
7h 17m
English
In the previous section, we used DI in a very straightforward way by just injecting components. React comes with its own mechanism for DI.
React context can be used to inject dependencies into components that are very far in the chain from the container component. This makes React context a great fit for global dependencies that are reused across the whole application.
Good examples of such a global dependency are a theme configuration, a logger, a dispatcher, a logged in user object, or language options.
Read now
Unlock full access