arrow_backBACK TO DRILLS
Black BeltcontextlockPREMIUM

useContext Returns Null When No Provider Wraps the Component

Consider this component tree with no Provider present anywhere above ThemeLabel:

REACT_MODULE // 0x42
const ThemeContext = createContext(null);
function ThemeLabel() {
const { mode } = useContext(ThemeContext);
return <span>{mode}</span>;
}
function App() {
return <ThemeLabel />;
}

What happens when App renders?

lock

This Drill is Locked

This is a premium drill. Continue on to the next free drill in the sequence.

CONTINUE DRILLarrow_forward
BugDojo
BlogFAQ

© 2026. Carved in code.