mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-24 20:53:08 +00:00
19 lines
381 B
JavaScript
19 lines
381 B
JavaScript
import {ThemeContext} from './theme-context';
|
|
|
|
class ThemedButton extends React.Component {
|
|
// highlight-range{3,12}
|
|
render() {
|
|
let props = this.props;
|
|
let theme = this.context;
|
|
return (
|
|
<button
|
|
{...props}
|
|
style={{backgroundColor: theme.background}}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
ThemedButton.contextType = ThemeContext;
|
|
|
|
export default ThemedButton;
|