State Management · Senior · Question 6 of 75

How do you prevent consumers of a CartContext from re-rendering when only dispatch-style actions are used?

Explanation

Buttons that only call addItem read CartActionsContext (memoized once), so cart changes don't re-render them. Only components that read CartStateContext update.

Further reading

Problem with a question

State Management · Senior · question 6

Test yourself

Take the State Management · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz