- Why is the Context API useful?
- it allows you to pass down state without having to pass props through each component layer
- Can a component outside of a provider get its context?
- No, context can only be accessed by child components of the provider
- What are some common use cases for using the Context API?
- If you need to make a UI theme available throughout a website
- Describe “Context Hell”
- When you have multiple types of Context being used by the same components
- This can result in multiple layers of wrapping around child components in the provider context
- global state
- state that is accessible to all components
- global context
- basically global state, available to all child components of the provider component
- provider
- the component that provides Context by wrapping sub components
- consumer
- a sub-component that utilizes Context