React & Modern Frontend (445 Qs)•Part 11: Legacy Architecture, Migration Patterns & Historical Internals (354 - 445)
What is context?
Context provides a way to pass data through the component tree without having to pass props down manually at every level.
vbnet
For example, authenticated users, locale preferences, UI themes need to be accessed in the application by many components.
javascript
const { Provider, Consumer } = React.createContext(defaultValue);