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

You wrap a subtree in <Ctx.Provider value={x}> and inside that subtree add a second <Ctx.Provider value={y}> for the same context. A consumer deep inside the inner provider reads the context. Which value does it get?

<Ctx.Provider value="outer"> <Middle> <Ctx.Provider value="inner"> <Leaf /> {/* reads Ctx */} </Ctx.Provider> </Middle> </Ctx.Provider>