Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Standardized guidelines and patterns for Frontend State React Context.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-13 | ✗→✓ | ▲ Improved | -43% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -30% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -20% | 0% |
| case-15 | ✓→✓ | = Same ✓ | 9% | 0% |
| case-01 | ✓→✓ | = Same ✓ | -45% | 0% |
createContexttypescriptimport { createContext, useContext, useState } from 'react'; interface ThemeContextType { theme: 'light' | 'dark'; toggleTheme: () => void; } const ThemeContext = createContext<ThemeContextType | null>(null); export function ThemeProvider({ children }: { children: React.ReactNode }) { const [theme, setTheme] = useState<'light' | 'dark'>('light'); const value = useMemo(() => ({ theme, toggleTheme: () => setTheme(t => t === 'light' ? 'dark' : 'light') }), [theme]); return ( <ThemeContext.Provider value={value}> {children} </ThemeContext.Provider> ); } export function useTheme() { const context = useContext(ThemeContext); if (!context) throw new Error('useTheme must be used within ThemeProvider'); return context; }
Other measured skills in the registry, with their headline benchmark lift.