Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| web:framework:react [2025/02/19 01:08] – [Contexte] jcheron | web:framework:react [2025/08/12 02:35] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 254: | Ligne 254: | ||
| </ | </ | ||
| + | ===== useContext ===== | ||
| + | |||
| + | Permet d' | ||
| + | |||
| + | <sxh js> | ||
| + | import { useContext, createContext } from " | ||
| + | |||
| + | const ThemeContext = createContext(" | ||
| + | |||
| + | function ThemedButton() { | ||
| + | const theme = useContext(ThemeContext); | ||
| + | |||
| + | return <button style={{ background: theme === " | ||
| + | Thème : {theme} | ||
| + | </ | ||
| + | } | ||
| + | </ | ||
| ===== Composants ===== | ===== Composants ===== | ||
| * [[https:// | * [[https:// | ||