import { createContext, useContext, useState, ReactNode } from 'react'; export type Theme = 'light' | 'dark'; // TODO: ThemeContext를 만드세요 (theme + toggle) export function ThemeProvider({ children, initial = 'light' }: { children: ReactNode; initial?: Theme }) { // TODO: useState로 theme 관리, toggle 함수 구현 // TODO: Provider로 children을 감싸 value를 내려주세요 return <>{children}</>; } export function useTheme(): { theme: Theme; toggle: () => void } { // TODO: useContext로 값을 꺼내 반환하세요 return { theme: 'light', toggle: () => {} }; }
Tests