this is confusing, especially when you start writing ES6 classes and have to figure out why you can't call setState of undefined...
We ideally need a morning challenge that introduces the concept of ensuring you know what your this is, and covers at least a few of the common ways you see this bound in React.
this
is confusing, especially when you start writing ES6 classes and have to figure out why you can't callsetState
ofundefined
...We ideally need a morning challenge that introduces the concept of ensuring you know what your
this
is, and covers at least a few of the common ways you seethis
bound in React.onClick={() => this.setState({ ... })}
this.handleClick = this.handleClick.bind(this)
(ugh)handleClick = () => this.setState({ ... })
🙌