Alex Krolick
7 years ago
1 changed files with 12 additions and 14 deletions
@ -1,19 +1,17 @@ |
|||||
import {ThemeContext} from './theme-context'; |
import {ThemeContext} from './theme-context'; |
||||
|
|
||||
class ThemedButton extends React.Component { |
function ThemedButton(props) { |
||||
// highlight-range{3-10}
|
// highlight-range{2-9}
|
||||
render() { |
return ( |
||||
return ( |
<ThemeContext.Consumer> |
||||
<ThemeContext.Consumer> |
{theme => ( |
||||
{theme => ( |
<button |
||||
<button |
{this.props} |
||||
{...this.props} |
style={{backgroundColor: theme.background}} |
||||
style={{backgroundColor: theme.background}} |
/> |
||||
/> |
)} |
||||
)} |
</ThemeContext.Consumer> |
||||
</ThemeContext.Consumer> |
); |
||||
); |
|
||||
} |
|
||||
} |
} |
||||
|
|
||||
export default ThemedButton; |
export default ThemedButton; |
||||
|
Loading…
Reference in new issue