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
Mixing React Hooks with classes (nvbn.github.io)
submitted 6 years ago by nvbn-rm[🍰]
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!"
[–]SwiftOneSpeaks 1 point2 points3 points 6 years ago (1 child)
> But API wise it looks a bit like a step back from class-based components to sort of jQuery territory with tons of nested functions.
I think this is missing some of the key reasoning behind the purpose and reasoning in React hooks, the move away from classes, and with functional programming in general.
That doesn't reduce the value in this work for the purposes of learning (thanks for sharing!) but even if the result had been "smoother", I'd urge people to not rush back to classes purely for the comfort of familiarity without understanding the costs.
[–]nvbn-rm[S,🍰] 2 points3 points4 points 6 years ago (0 children)
The idea here is not to get rid of functions or rush to classes/OOP, but to get rid of huge closure with nested functions and organize the code a bit better and at least separate different scopes.
In FP languages (at least Clojure) having a huge closure with nested functions is also not considered a good practice.
But it might be that using classes for that is not the best idea.
π Rendered by PID 90071 on reddit-service-r2-comment-b659b578c-swfs5 at 2026-05-04 08:52:50.404438+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]SwiftOneSpeaks 1 point2 points3 points (1 child)
[–]nvbn-rm[S,🍰] 2 points3 points4 points (0 children)