Skip to content

Instantly share code, notes, and snippets.

@sagiavinash
Last active April 3, 2016 19:51
Show Gist options
  • Save sagiavinash/e5016db3e54146c26d45de7e01f0b9e6 to your computer and use it in GitHub Desktop.
Save sagiavinash/e5016db3e54146c26d45de7e01f0b9e6 to your computer and use it in GitHub Desktop.
Use Arrow functions for event callbacks instead of binded functions
/* preferred way */
handleClick={() => self.handleClick(index)}
//(or)
handleClick={e => self.handleClick(e, index)}
/* current way */
handleClick={this.handleClick.bind(this, index)}
//(or)
handleClick={this.handleClick.bind(null, index)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment