Toggle theme provider

Context & Patterns β€” Beginner React challenge.

Wire up a small theme system with a context provider, a `useTheme` hook, and a toggle. Great warmup for the Context & Patterns track.

Requirements

Signature

type Theme = "light" | "dark";
function useTheme(): { theme: Theme; toggle: () => void };

Example

<ThemeProvider>
  <App />
</ThemeProvider>

Constraints

🏷️ Get 20% OFF on Yearly & Lifetime plans β€” use code 🏷️ Get 20% OFF on Yearly & Lifetime plans β€” use code 🏷️ Get 20% OFF on Yearly & Lifetime plans β€” use code 🏷️ Get 20% OFF on Yearly & Lifetime plans β€” use code 🏷️ Get 20% OFF on Yearly & Lifetime plans β€” use code 🏷️ Get 20% OFF on Yearly & Lifetime plans β€” use code
Loading workspace…