Loading…
Loading…
Frontend · Senior full stack preparation
Understand providers, state ownership, and the tradeoffs of sharing data through context. Read practical answers and use the examples to explain your reasoning.
6 of 6 questions
Context makes a provider value available to descendants without passing it through each intermediate component. Consumers read the nearest matching provider.
Link to question 17It distributes a value through a subtree. That value can include data and update functions, but context itself is not a persistence mechanism.
Link to question 18Decide from update frequency, consumer count, debugging requirements, and transition complexity. Context can suit scoped configuration; Redux can suit coordinated feature state. Neither choice is universally better.
Link to question 19Consider render behavior and maintenance. Context consumers update when their provider value changes. Split unrelated contexts and stabilize values when useful; store selectors can narrow subscriptions for frequently changing data.
Link to question 20The provider component or an external store owns changing state. Context exposes its current value. Pair it with useState or useReducer when consumers need updates.
Link to question 21React data flow remains one-way. A provider passes values down; a consumer can invoke a supplied callback to request an update at the owner. The changed value then flows down on the next render.
Link to question 22