Last active
April 7, 2017 22:43
-
-
Save ryanflorence/5acb8fe383957d317951ad3406e0eb6e to your computer and use it in GitHub Desktop.
This file contains 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
// prop callback | |
class Compoennt { | |
render() { | |
return ( | |
<div> | |
<Thing onChange={(val) => { | |
this.setState({ val1: val }) | |
}}/> | |
<Thing onChange={(val) => { | |
this.setState({ val2: val }) | |
}}/> | |
<div>{this.state.val1 + this.state.val2}</div> | |
</div> | |
) | |
} | |
} | |
React.cloneElement(el, { val }) | |
// context | |
<Thing> | |
<Child/> | |
</Thing> | |
// render callback | |
<Thing> | |
{(val1) => ( | |
<Thing> | |
{(val2) => ( | |
val1 + val2 | |
)} | |
</Thing> | |
)} | |
</Thing> | |
// higher order component | |
withStuff(Thing) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment