mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
13 lines
311 B
JavaScript
13 lines
311 B
JavaScript
const Button = ({theme, children}) => (
|
|
<button className={theme ? 'dark' : 'light'}>
|
|
{children}
|
|
</button>
|
|
);
|
|
|
|
// highlight-range{1,3}
|
|
export default React.forwardRef((props, ref) => (
|
|
<ThemeContext.Consumer>
|
|
{theme => <Button {...props} theme={theme} ref={ref} />}
|
|
</ThemeContext.Consumer>
|
|
));
|