mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-26 07:25:20 +00:00
18 lines
338 B
JavaScript
18 lines
338 B
JavaScript
import {ThemeContext} from './theme-context';
|
|
|
|
function ThemedButton(props) {
|
|
// highlight-range{2-9}
|
|
return (
|
|
<ThemeContext.Consumer>
|
|
{theme => (
|
|
<button
|
|
{...props}
|
|
style={{backgroundColor: theme.background}}
|
|
/>
|
|
)}
|
|
</ThemeContext.Consumer>
|
|
);
|
|
}
|
|
|
|
export default ThemedButton;
|