Skip to content

Instantly share code, notes, and snippets.

@haldarmahesh
Last active August 29, 2018 07:51
Show Gist options
  • Select an option

  • Save haldarmahesh/344bb5cd3df02981993dd848862ef318 to your computer and use it in GitHub Desktop.

Select an option

Save haldarmahesh/344bb5cd3df02981993dd848862ef318 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
import ThemeContext from './context/ThemeContext';
export default class Body extends Component {
render() {
return (
<ThemeContext.Consumer>
{
(theme) => (
<div className="body" style={{color: theme.fontColor, background: theme.bodybg}}>
Some text goes here
</div>
)
}
</ThemeContext.Consumer>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment