What state belongs in Context in a React app?
Widely-read, rarely-changed state: the logged-in user, theme, localization, and feature flags. These are read by many distant components but change rarely, which is the perfect fit for Context.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in useState vs Context API for UI Data Flow in React
useState for local state used by one component or its close children. Context for deeply shared state read by many distant components, like auth and theme. Choose based on how widely the state is shared.
Because Context causes all consumers to re-render when the value changes. For high-frequency updates, this causes too many re-renders. useState only re-renders the component that owns it and its children, so it is often the better choice for local state.
Prop drilling is passing props through many levels to reach a deeply nested component. Context fixes it by providing the value directly to any component in the tree, without threading it through every intermediate level.
Still have questions?
Browse all our FAQs or reach out to our support team
