4 ms·
I am far more confused by hooks than by classes and 'this'.
by petilon 6y ago
I am far more confused by hooks than by classes and 'this'.
- pier25 6y agoAlso you can't really try to protect JavaScript developers from understanding this. It's a fundamental part of the language.
- williamdclt 6y agoDisagree. I understand `this`, but I very, very rarely encounter situations where it doesn't mean the same thing as Java's `this`. When you work on a full-React codebase, it just doesn't really happen. We used to have weird `this` behaviour on event handlers, but arrow functions and hooks fixed this. Not saying it's good or bad, just an observation
- pier25 6y agoRight, but without understanding this one doesn't really understand arrow functions either.
- hombre_fatal 6y ago`this.foo = this.foo.bind(this)` and then the new feature of method properties `foo = () => this` vs `foo() { this }` are constant sources of confusion for people who aren't well-established in Javascript/this. Not to mention function() vs arrow functions. All exist because of the idiosyncrasies of `this` that you may be discounting because of your familiarity and already being over the learning curve that ensnares people daily.