mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 04:12:34 +00:00
11 lines
241 B
JavaScript
11 lines
241 B
JavaScript
const ThemeContext = React.createContext('light');
|
|
|
|
function ThemedButton(props) {
|
|
// highlight-range{2-4}
|
|
return (
|
|
<ThemeContext.Consumer>
|
|
{theme => <button className={theme} {...props} />}
|
|
</ThemeContext.Consumer>
|
|
);
|
|
}
|