Skip to content

Instantly share code, notes, and snippets.

@dabbott
Created November 26, 2016 17:59
Show Gist options
  • Save dabbott/7dbede9af3639fd8bbfe2531560b10c4 to your computer and use it in GitHub Desktop.
Save dabbott/7dbede9af3639fd8bbfe2531560b10c4 to your computer and use it in GitHub Desktop.
react-context-provider
@setContext
class Provider extends Component {
render() {
return null
}
}
@context(['color'])
class Hello extends Component {
render() {
const {color} = this.props
return (
<div style={color}>
Hello
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment