Skip to content

Instantly share code, notes, and snippets.

@JonathonAshworth
Last active December 10, 2016 01:44
Show Gist options
  • Save JonathonAshworth/e78015eae82d953f5b81092ebd78cf80 to your computer and use it in GitHub Desktop.
Save JonathonAshworth/e78015eae82d953f5b81092ebd78cf80 to your computer and use it in GitHub Desktop.
Callbacks in React
const SomeComponent = React.createClass({
propTypes: {
doSomething: React.PropTypes.func
},
someOtherFunction: function() {
// Do some other stuff
this.props.doSomething();
},
render: function() {
return <div onClick={someOtherFunction}/>;
}
});
const SomeComponent = React.createClass({
propTypes: {
doSomething: React.PropTypes.func
},
render: function() {
return <div onClick={this.props.doSomething}/>;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment