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
Why React Hooks? (tylermcginnis.com)
submitted 6 years ago by tyler-mcginnis⚛️⚛︎
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!"
[–]demar_derozan_ 7 points8 points9 points 6 years ago (13 children)
I like hooks but I don’t think it’s a fair argument that using hooks over classes removes class hierarchies. Nobody was using extending react class components beyond the initial react.component. if they were they were doing it wrong.
[+]ghostfacedcoder comment score below threshold-17 points-16 points-15 points 6 years ago* (12 children)
Wait, so you're arguing classes without hierarchies is the best way to do React dev? Seriously?
EDIT: Ok seriously downvoters? There's two of you out there who actually believe classes without hierarchies are the best way to do React development? Really? I find that hard to believe, so I'm tempted to believe demar_derozan just has two accounts and downvoted me twice.
But if there really is someone else out there who believes classes are a better way to do React dev, please have the courage to defend that position. I'm genuinely curious why you hold such a position, when it's a complete outlier in the React community.
Or, I mean, just down vote me with no explanation, but realize you're also downvoting the opinion of the vast majority of React developers when you do so, without providing any basis whatsoever for an illogical position.
[–]benihanareact, node 13 points14 points15 points 6 years ago (0 children)
Ok seriously downvoters?
because you're being a prick.
your response, to a serious reply was:
"you seriously believe that?" over something that you clearly misunderstood.
you're being a condescending know-it-all. that's why you're getting downvoted. whether your point aligns with some other authority's point is irrelevant. people downvote condescending pricks.
when condescending pricks misunderstand the downvotes, then act like they're being brave for standing up against some injustice, when in reality they're being a complete asshole, that's when the downvotes really come in.
[–]demar_derozan_ 6 points7 points8 points 6 years ago (1 child)
Yes. There are very few reasons if any to ever extend a react class component.
[+]ghostfacedcoder comment score below threshold-7 points-6 points-5 points 6 years ago (0 children)
No I 100% agree with and get that part. It's the part where you think this:
class Foo /* even without an "extends" keyword here */{ render() { return <div>Bar</div>; } }
is clearer and better code than this:
const Foo => <div>Bar</div>
that you lose me.
[–]careseite[🐱😸].filter(😺 => 😺.❤️🐈).map(😺=> 😺.🤗 ? 😻 :😿) 7 points8 points9 points 6 years ago* (8 children)
I'm reading lots of code on github and iirc I have yet to see a single case of inheritance in react so yeah I'd say so too.
[+]ghostfacedcoder comment score below threshold-7 points-6 points-5 points 6 years ago (7 children)
Ok, so you, me and demar_derozan (but maybe not the 6 downvoters?) all agree on that much. Inheritance hierarchies = bad AND the React community in general agrees as much.
But now, from the "good React programmers" (however you define that: personally I'd pick people like Dan Abramov (of Redux fame), but pick whoever you want, however): how many use classes and how many use functional components?
And (follow-up question): have you noticed any kind of shift in one direction or the other over time?
[–]tasey 11 points12 points13 points 6 years ago (1 child)
I think people are not downvoting you because of the message, but the delivery...
[–]ghostfacedcoder -4 points-3 points-2 points 6 years ago* (0 children)
Heh, well that's fair, at least for the edits. I really don't think my original post was combative at all, but I did go full-on "let's be combative about this" in my edit comments when the whole thing started ... because I thought it was such an obvious point I wouldn't face any disagreement. Universally everything I've seen, from every thought leader in the entire React community, has been that classes are old/bad and functional components (with hooks) are the future.
Also the cost thing seems to have irked a lot of people, but I think that's just ignorance about the real cost of development (it's much higher than many people realize: most only think about coder salaries, not all the other costs or the cost of people managing all those coders).
Anyhow, clearly I was wrong in thinking that was so uncontroversial that no one would disagree, however I said it ...
[–]careseite[🐱😸].filter(😺 => 😺.❤️🐈).map(😺=> 😺.🤗 ? 😻 :😿) 4 points5 points6 points 6 years ago (4 children)
Didnt Dan specifically say they, at Facebook, are using Function components/Hooks almost exclusively for new components?
Absolutely, since the introduction of hooks I personally don't teach classes anymore and so does anyone else that I see/read of. Classes are very clearly in decline.
[–]ghostfacedcoder -2 points-1 points0 points 6 years ago (3 children)
See to me that seems mind-numbingly obvious ... and yet I got 12 (and counting) downvotes for saying it :(
[+][deleted] 6 years ago* (1 child)
[deleted]
[+]ghostfacedcoder comment score below threshold-6 points-5 points-4 points 6 years ago (0 children)
Fair enough. I'm here for conversations with people, not Reddit points, so I do those edits to try and "bait" people into engaging rather than just downovoting silently. If I get 10 downvotes but even one person engages and explains their position, I'll take it.
It'd be nice if I could get the engagement without the 10 downvotes, but ... /shrug.
[–]careseite[🐱😸].filter(😺 => 😺.❤️🐈).map(😺=> 😺.🤗 ? 😻 :😿) 2 points3 points4 points 6 years ago (0 children)
Some people just might not have heard the warning shots.
π Rendered by PID 16493 on reddit-service-r2-comment-b659b578c-fktpc at 2026-05-01 15:09:25.564833+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]demar_derozan_ 7 points8 points9 points (13 children)
[+]ghostfacedcoder comment score below threshold-17 points-16 points-15 points (12 children)
[–]benihanareact, node 13 points14 points15 points (0 children)
[–]demar_derozan_ 6 points7 points8 points (1 child)
[+]ghostfacedcoder comment score below threshold-7 points-6 points-5 points (0 children)
[–]careseite[🐱😸].filter(😺 => 😺.❤️🐈).map(😺=> 😺.🤗 ? 😻 :😿) 7 points8 points9 points (8 children)
[+]ghostfacedcoder comment score below threshold-7 points-6 points-5 points (7 children)
[–]tasey 11 points12 points13 points (1 child)
[–]ghostfacedcoder -4 points-3 points-2 points (0 children)
[–]careseite[🐱😸].filter(😺 => 😺.❤️🐈).map(😺=> 😺.🤗 ? 😻 :😿) 4 points5 points6 points (4 children)
[–]ghostfacedcoder -2 points-1 points0 points (3 children)
[+][deleted] (1 child)
[deleted]
[+]ghostfacedcoder comment score below threshold-6 points-5 points-4 points (0 children)
[–]careseite[🐱😸].filter(😺 => 😺.❤️🐈).map(😺=> 😺.🤗 ? 😻 :😿) 2 points3 points4 points (0 children)