React Code Completion Hard +35 XP
Context Consumer
Complete the hook to consume context.
ReactFill in the blank
const theme = ___(ThemeContext);Type the missing code
Show answer and explanation
Answer: useContext
useContext(ThemeContext) subscribes the component to the ThemeContext and returns its current value.
Hint: Which hook reads a Context value?
What this challenge tests
Code Completion in React: context, hooks.