The best advice you can give a JS and React beginner is to use this syntax for defining EVERY SINGLE component method: `method = () => {}`
Would a class decorator work? Or too easy to forget? What if it was linted?
-
-
Yeah, a decorator approach exists: https://www.npmjs.com/package/autobind-decorator … Though I prefer Ryan's approach and typically use it.
-
What if the decorator was applied to the entire class?
-
Yeah, that's doable with the lib I just linked to.
-
This sounds like it brings back the exact same issue: createClass over-binds method leading to worse perf
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.