1
ReactAdvanced#hooks#state
useContext reads a value from the nearest matching Provider, avoiding prop drilling for global-ish data such as theme, locale or the current user. Every consumer re-renders when the context value changes.
const ThemeCtx = createContext('light');
<ThemeCtx.Provider value="dark"><App /></ThemeCtx.Provider>
const theme = useContext(ThemeCtx);