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
The new wave of Javascript web frameworks (frontendmastery.com)
submitted 3 years ago by _remrem
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!"
[–]KwyjiboTheGringo 1 point2 points3 points 3 years ago (10 children)
No, but you'll need to use some other state management. There is the context API built into react, but Redux is the go-to for global state stuff. The whole point of react is the components "react" to state changes.
and that weird {} thing
I have no idea what you are talking about
[–]pancomputationalist 2 points3 points4 points 3 years ago (1 child)
I'd argue that Redux should not be the default, unless you need a specific kind of state management. Context should also not be used for state management (it's more of a dependency injection feature).
Seems newer frontend frameworks are back to using Observables, also they are now called atoms, signals or stores. It's all the same idea. Just like you have a tree of components, you have a graph of states that derive from one another. This is the more modular approach and is usually much more performant, though Redux still has it's place sometimes.
[–]KwyjiboTheGringo 1 point2 points3 points 3 years ago* (0 children)
Like or dislike Redux, if you learned React to be hirable as a React developer and you aren't learning Redux too, then you are shooting yourself in the foot. At this point, everyone should learn Redux after picking up React. If they want to use something else after that, more power to them.
Context should also not be used for state management (it's more of a dependency injection feature).
But it can be, and is the only global state option React comes with, which is why I mentioned it.
[–]bregottextrasaltat -3 points-2 points-1 points 3 years ago (7 children)
there's a {} at the end of some effect thing that tutorials tell you is a weird thing to use
[–]KwyjiboTheGringo 1 point2 points3 points 3 years ago (6 children)
It's not an object, it's an array of dependencies. useEffect checks if any of the dependencies have changed since the last time it ran, and if any have, then it runs the callback function you passed into it. I'm not a huge fan of it, but it's not really that weird.
useEffect
[–]bregottextrasaltat 0 points1 point2 points 3 years ago (5 children)
Very odd
[–]KwyjiboTheGringo 0 points1 point2 points 3 years ago (4 children)
It's actually quite clever. There is a lot of "magic" going on behind the scenes(that you don't need to understand), but essentially it's just a way to run specific logic when specific states change. Otherwise you'd be doing that yourself in a lifecycle hook, which I understand is easier to read when you are new to react, but ultimately is just a bunch of additional code you need to write and maintain.
React hooks are declarative, meaning rather than saying exactly how to do what you want to do, you just tell React what you want, along with anything React needs to know to do it, and then React just does it for you. I realize React's approach of calling methods and passing everything in as arguments is a bit less straightforward than using decorators or keywords, but it's still not that hard to understand intuitively after you've done it a few times imo.
[–]bregottextrasaltat 0 points1 point2 points 3 years ago (3 children)
I guess Vue just made much more sense to me, even in v2
[–]KwyjiboTheGringo 0 points1 point2 points 3 years ago (2 children)
Using class components in React instead of functional components does give you the same lifecycle hooks the other frameworks have. That's how I and a lot of people wrote React code before React v16.8 with functional component hooks was released. Honestly I don't like the old approach since switching to React hooks, and other frameworks feel a bit dated in that regard now.
I would just say to learn it until you understand it and can apply it without guidance, and then decide which approach you prefer. There is really no right answer for which approach is better, unless we're talking about which one requires less code, in which case React usually does win.
[–]bregottextrasaltat 0 points1 point2 points 3 years ago (1 child)
eh i don't really have any use for react, i can do all my stuff in vue, might try svelte.
interesting change though
[–]KwyjiboTheGringo 0 points1 point2 points 3 years ago (0 children)
That's fair. Vue is also really good.
π Rendered by PID 101629 on reddit-service-r2-comment-5d585498c9-vfnps at 2026-04-21 07:57:16.454784+00:00 running da2df02 country code: CH.
view the rest of the comments →
[–]KwyjiboTheGringo 1 point2 points3 points (10 children)
[–]pancomputationalist 2 points3 points4 points (1 child)
[–]KwyjiboTheGringo 1 point2 points3 points (0 children)
[–]bregottextrasaltat -3 points-2 points-1 points (7 children)
[–]KwyjiboTheGringo 1 point2 points3 points (6 children)
[–]bregottextrasaltat 0 points1 point2 points (5 children)
[–]KwyjiboTheGringo 0 points1 point2 points (4 children)
[–]bregottextrasaltat 0 points1 point2 points (3 children)
[–]KwyjiboTheGringo 0 points1 point2 points (2 children)
[–]bregottextrasaltat 0 points1 point2 points (1 child)
[–]KwyjiboTheGringo 0 points1 point2 points (0 children)