Skip to main content
React Code Reorder Hard +35 XP

Context Provider

Arrange Context API correctly.

Click lines in the correct order

Available lines3 left

Your order

Click lines above to build your solution.

Show answer and explanation

Answer: const ThemeContext = createContext("light"); export function App() { return <ThemeContext.Provider value="dark"><Child /></ThemeContext.Provider>; } const theme = useContext(ThemeContext);

Create context, wrap with Provider passing value, consume with useContext.

Hint: Create, provide, then consume.

What this challenge tests

Code Reorder in React: context, provider.

Related challenges