Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumReactcontext and useContextSingle-choice MCQ

Two unrelated consumers read different fields from one context. The Provider re-renders and recreates its value object even though only one field changed. What is the consequence for the consumers?

function Provider({ children }) { const [user, setUser] = useState(...); const [theme, setTheme] = useState(...); const value = { user, theme, setTheme }; return <Ctx.Provider value={value}>{children}</Ctx.Provider>; }