State Management · Middle · Question 11 of 75
When is it better to put a value in Context instead of passing it explicitly through props?
- ✓Correct answer: When many components at different depths need it and it rarely changes
- 2Whenever a prop is used by more than one component
- 3When the value is a function, since functions can't be props
Explanation
Context trades explicitness for convenience: it's harder to see where data comes from, and components depend on a provider being present. Use it for truly cross-cutting values; otherwise explicit props or composition are clearer.