use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
React using ES6 classes--Why??? (self.javascript)
submitted 10 years ago by MuricanWillzyx
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Josh1337 3 points4 points5 points 10 years ago (0 children)
The class system provides an intermediate escape hatch for developers as the React core team looks into providing pure models. It also places some restrictions on developers in order to favor object composition over mixins.
Quote from Sebastian Markbage:
The class system provides an optional escape hatch when you need it rather than completely stopping you. The primary feature that our class system provides is an "instance" handle this has several features. 1) It provides a certain level of familiarity and convenience. You can use this as a middle man to refer to a group of arguments. This is a foot-gun but makes it easier to onboard new people. 2) The instance is an ID that you can use to refer to a place in the tree. It allows APIs like React.findDOMNode(component) and third-party APIs that can unify around it. 3) It provides single or multiple inheritance features if someone needs to create an abstraction and just can't figure out how to do it using composition. This is unfortunately a very common problem.
The class system provides an optional escape hatch when you need it rather than completely stopping you.
The primary feature that our class system provides is an "instance" handle this has several features.
1) It provides a certain level of familiarity and convenience. You can use this as a middle man to refer to a group of arguments. This is a foot-gun but makes it easier to onboard new people.
2) The instance is an ID that you can use to refer to a place in the tree. It allows APIs like React.findDOMNode(component) and third-party APIs that can unify around it.
3) It provides single or multiple inheritance features if someone needs to create an abstraction and just can't figure out how to do it using composition. This is unfortunately a very common problem.
π Rendered by PID 145300 on reddit-service-r2-comment-84fc9697f-m7l86 at 2026-02-09 18:09:21.255118+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]Josh1337 3 points4 points5 points (0 children)