Created
March 4, 2019 08:10
-
-
Save behnamazimi/d8d0608e317296bcf2860d1b8279da2d to your computer and use it in GitHub Desktop.
Say By to .bind(this)
This file contains 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
// Dirty Code | |
class MyComponent extends Component { | |
constructor(props) { | |
super(props) | |
this.handleOne = this.handlerOne.bind(this) | |
this.handleTwo = this.handlerTwo.bind(this) | |
this.handleThree = this.handlerThree.bind(this) | |
} | |
handleOne() { | |
} | |
handleTwo() { | |
} | |
handleThree() { | |
} | |
} | |
// Clean Code | |
class MyComponent extends Component { | |
handleOne = () => { | |
} | |
handleTwo = () => { | |
} | |
handleThree = () => { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment