Last active
December 10, 2016 01:44
-
-
Save JonathonAshworth/e78015eae82d953f5b81092ebd78cf80 to your computer and use it in GitHub Desktop.
Callbacks in React
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
const SomeComponent = React.createClass({ | |
propTypes: { | |
doSomething: React.PropTypes.func | |
}, | |
someOtherFunction: function() { | |
// Do some other stuff | |
this.props.doSomething(); | |
}, | |
render: function() { | |
return <div onClick={someOtherFunction}/>; | |
} | |
}); |
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
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