The React Context Traps I Keep Stepping On
I have lost the same Context fight on three different teams. These are the 5 traps I now check for in every Provider before approving the PR, with the rewrites that actually stop the re-render storm.
By @felixhaddad
December 2, 2025
·
Updated August 15, 2026
800 views
24
4.4 (11)
Walk me through why every Consumer below re-renders on every Provider re-render, even though the value looks stable. Then fix it without changing what the Provider exposes.
What I saw in the PR
The team had wired up an AuthProvider so every component could grab the user. Wrapping a 200-node tree, the React profiler showed every Consumer re-rendering on every parent state change. The reviewer (me) flagged it on the second pass.
4 more questions and all solutions are locked.
Purchase this item to access all questions, code snippets, and solutions.
