Skip to content

Instantly share code, notes, and snippets.

@MoOx
Last active August 29, 2015 14:10
Show Gist options
  • Save MoOx/cc15000ff93305b926ce to your computer and use it in GitHub Desktop.
Save MoOx/cc15000ff93305b926ce to your computer and use it in GitHub Desktop.
bind an api
createClass({
commonApi: {
method: function() {
// this will be the instance
}
},
getInitialState() {
this.api = {}
Object.keys(this.commonApi).forEach(function(method) {
this.api[method] = this.commonApi[method].bind(this)
})
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment