Created
November 26, 2016 17:59
-
-
Save dabbott/7dbede9af3639fd8bbfe2531560b10c4 to your computer and use it in GitHub Desktop.
react-context-provider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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