Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.
const theme = useContext(ThemeContext);
return <button style={{ background: theme.background }}>Bouton</button>;
const [theme, setTheme] = useState('light');
const value = { theme, setTheme };
<ThemeContext.Provider value={value}>...
const ThemeContext = React.createContext('light');
<ThemeContext.Provider value="dark">
<App />
</ThemeContext.Provider>