-
-
Save hellobrian/78bfe71557ef3c6eb1b9389374df4be0 to your computer and use it in GitHub Desktop.
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
// 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