React.createContext
will return an object that holds 2 components:
- Provider
- Consumer
These 2 components can share data, the Consumer
can "grab" the context data from the nearest Provider
up the tree (or use the useContext
hook instead of rendering a Consumer
).
You should create the context object outside the…
Top comments (0)