Skip to content

Instantly share code, notes, and snippets.

@cbroberg
Last active October 8, 2017 21:29
Show Gist options
  • Save cbroberg/e9c611a5d5d00a5c33274d3e7cfe79cb to your computer and use it in GitHub Desktop.
Save cbroberg/e9c611a5d5d00a5c33274d3e7cfe79cb to your computer and use it in GitHub Desktop.
Render Props and Ensuring Referential Identity
class MouseMover extends Component {
renderMouseMovement = ({ x, y }) => {
return <Text>The mouse position is ({x}, {y})</Text>
}
render() {
return (
<MouseMove render={this.renderMouseMovement} />
)
}
}
// and calling the MouseMover somwhere later:
...
<MouseMover />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment