Implementation for useDependency Pattern as a Hook
Examine the basic implementation and usage for “useDependency” hook in an example application.
We'll cover the following...
The following exercise demonstrates the design seen in the previous lesson. Look at different parts of the implementation one by one.
DependencyProvider
It is essentially a context wrapper component for App
.
Line #5 defines a DependencyProviderContext
object that will be used to share config
in other components.
App.js
The config
object includes ...