Created
October 6, 2017 18:08
-
-
Save ryanflorence/187e82831d36fe8fa91952b616a33527 to your computer and use it in GitHub Desktop.
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
class Dashboard extends Component { | |
constructor(props) { | |
super(props) | |
// bind? slows down the initialization path, looks awful | |
// when you have 20 of them (I have seen your code, I know) | |
// and it increases bundle size | |
this.handleStuff = this.handleStuff.bind(this) | |
// _this is ugly. | |
var _this = this | |
this.handleStuff = function() { | |
_this.setState({}) | |
} | |
// If you can use an ES class then you can probably use an arrow | |
// function (babel, or a modern browser). This isn't too bad but | |
// putting all of your handlers in the constructor is kind of | |
// not awesome | |
this.handleStuff = () => { | |
this.setState({}) | |
} | |
} | |
// this is nice, but it isn't JavaScript, not yet anyway, so now | |
// we need to talk about how TC39 works and evaluate our draft | |
// stage risk tolerance | |
handleStuff = () => {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The last pattern looks the cleans so what do you mean by is not Javascript yet?