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

A context provider's value is correctly memoized with useMemo. A consumer reads the context and is itself wrapped in React.memo. The provider's parent re-renders with unchanged props. Does the memoized consumer re-render?

const value = useMemo(() => ({ user }), [user]); // <Ctx.Provider value={value}><MemoChild /></Ctx.Provider> // MemoChild = React.memo(() => { const { user } = useContext(Ctx); ... })