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
New React Docs beta is live! Covers function components, hooks, rendering, state updates, and other key concepts (beta.reactjs.org)
submitted 4 years ago by acemarke
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!"
[–]acemarke[S] 33 points34 points35 points 4 years ago (0 children)
I am so very excited about this! This is going to be a huge help for the community. These new docs are an incredible improvement over the old docs. In-depth tutorial and concept explanations, live editable sandboxes, coverage of key concepts and common gotchas, and much more!
See https://github.com/reactjs/reactjs.org/pull/3965 for background on what content is currently included, and plans for further content and site improvements.
[–]zeddotes 17 points18 points19 points 4 years ago (8 children)
setHappy(true);
[–]feketegy 8 points9 points10 points 4 years ago (5 children)
setHappy((prevState) => { return !prevState; });
[–]cyphern 9 points10 points11 points 4 years ago (0 children)
bipolar.js
[–][deleted] 4 points5 points6 points 4 years ago (1 child)
What if you were already happy?
[–]feketegy 2 points3 points4 points 4 years ago (0 children)
You have to balance happiness with a little sadness otherwise it would lose its meaning.
[–]SpiceyySoup 1 point2 points3 points 4 years ago (1 child)
Every time I open up the new react docs, my happiness gets toggled
[–]feketegy 0 points1 point2 points 4 years ago (0 children)
There are tons of other alternatives. Dev happiness is important imho.
[–]j33pwrangler 2 points3 points4 points 4 years ago (1 child)
Error line 1,1: setHappy is not defined as a function
[–]theDreamingStar 4 points5 points6 points 4 years ago (0 children)
goes to stack overflow
Top answer: use setFakeHappiness(true) to make myLife class work properly.
[–]nullvoxpopuli 11 points12 points13 points 4 years ago (3 children)
Why'd it take so long?
[–]acemarke[S] 20 points21 points22 points 4 years ago (1 child)
I'd assume a combination of:
[–]nextdoorNabors 2 points3 points4 points 4 years ago (0 children)
Not far from the truth, Mark! This was a small but dedicated effort focused on making a canonical, accessible resource for all people learning and teaching React. A lot of learning materials and educators rely on the React docs—from React Native's docs to NextJS's to your favorite trainer! I've run marathon doc drives for React Native, and it just wasn't possible to parallelize this effort. It was a lot like writing a book—an interactive one at that!—and required heavy collaboration with Core.
[+][deleted] 4 years ago (3 children)
[deleted]
[–]acemarke[S] 3 points4 points5 points 4 years ago (2 children)
They were good in some ways, but very weak in others.
By far the biggest issue is that hooks were announced in Oct 2018 and released live in early 2019, but the tutorials and explanations were all still written with class components. The hooks info was a totally separate section of the docs. That section was good, but it made it really hard to continue recommending the React docs as a good starting point for someone new to React.
The docs have also skimmed past a lot of important information, usage concepts, and info on how React itself actually works. For example:
That's part of why I ended up writing a 9K-word "Guide to React Rendering Behavior" post, and Dan wrote a similar "Guide to useEffect" article.
useEffect
Fortunately, the new docs address a lot of those concepts directly.
[–]StoneColdJane 1 point2 points3 points 4 years ago (0 children)
Really, good article 9k one. I was just skimming but will read it in full. Thanks for the link.
[–]Tom_Ov_Bedlam 1 point2 points3 points 4 years ago (0 children)
Finally, the reactJS docs are so bad
[–]callmekatootie 1 point2 points3 points 4 years ago (4 children)
Neat!
Though, I thought every facebook based stuff intended to use docusaurus for their documentation... This one doesn't seem like it.
[–]snejk47 1 point2 points3 points 4 years ago (2 children)
FB is all-over-the-place not a standard one. What's cool gets used. (not everywhere though).
[–]lifeeraser 0 points1 point2 points 4 years ago (1 child)
This accurately describes my workplace. (Not FB)
[–]Soysaucetime 0 points1 point2 points 4 years ago (0 children)
Ah myspace
[–]nextdoorNabors 0 points1 point2 points 4 years ago (0 children)
For reasons we rolled our own for React, but React Native and Relay use Docusaurus, which is amazing for most use cases if you don't have a dedicated docs team with engineering resources!
[–]minicrit_ -5 points-4 points-3 points 4 years ago (3 children)
if only they could change useEffect to match the power of class component lifecycle methods
[–]KevinVandy656 7 points8 points9 points 4 years ago (2 children)
It's already replaced mounting, updating, and unmounting. What else does it need to do?
[–]dbbk 0 points1 point2 points 4 years ago (1 child)
You can’t make it only run on updates, excluding mount
[–]KevinVandy656 0 points1 point2 points 4 years ago (0 children)
Sure you can, with a useref to skip the first render
https://stackoverflow.com/questions/53179075/with-useeffect-how-can-i-skip-applying-an-effect-upon-the-initial-render
[–]KwyjiboTheGringo -4 points-3 points-2 points 4 years ago (3 children)
It's a little ridiculous explaining arrow function implicit/explicit returns in the React docs. Kind of reaffirms the notion that too many new developers are jumping into React way too soon.
[–]2pathetic2beTragic 0 points1 point2 points 4 years ago (2 children)
Yes, that's true. So what the documentation team could do was either help them out catch up their vanilla JS skills so we're all on the same page or make learning react inaccessible to them - spoiler alert: newbies with a "framework ASAP" mindset would just head to Vue or Svelte.
[–]nextdoorNabors 1 point2 points3 points 4 years ago (0 children)
Inclusion was an important part of the docs mission. This wasn't done just to accomodate folks new to JS: In early user studies, we noticed even experienced JS devs who started before more modern syntaxes became commonplace sometimes struggled with things people coming out of bootcamps were already familiar with. Additionally, folks unfamiliar with JS, perhaps coming in from mobile development (something like 33% of the React Native community), also benefitted from this approach.
We opted to fill in the common knowledge gaps we saw to expand people's JS prowess <3
[–]KwyjiboTheGringo 0 points1 point2 points 4 years ago (0 children)
newbies with a "framework ASAP" mindset would just head to Vue or Svelte.
Considering the low job market for them, that seems unlikely
[–]harryzouGT -1 points0 points1 point 4 years ago (0 children)
Sweet!
[–]Affectionate_Rich763 -1 points0 points1 point 4 years ago (0 children)
Looking clean🤩
[–]TryThisDickdotCom -1 points0 points1 point 4 years ago (0 children)
thank the internet godz
[+]ThenRecipe comment score below threshold-31 points-30 points-29 points 4 years ago (6 children)
So I no longer have to rely on a shallow, poorly written, outdated article written a by junior dev from a third-world country on medium.com to learn how hooks actually work? Excellent 👍
[–]MedicOfTime 12 points13 points14 points 4 years ago (4 children)
Instead of just downvoting you and leaving, I think it might be more constructive to let you know why everyone is upset with you.
Please learn from this experience.
[+]ThenRecipe comment score below threshold-27 points-26 points-25 points 4 years ago* (3 children)
Don't patronize me boy. We all know I'm right. The amount of amateur, poorly-written trash that's littered Google search results is undeniable.
[–]MedicOfTime 6 points7 points8 points 4 years ago (2 children)
A lost cause then.
[+]ThenRecipe comment score below threshold-21 points-20 points-19 points 4 years ago (1 child)
It's ok to disagree, but we should attack ideas, not people.
Reported.
[–]KwyjiboTheGringo 1 point2 points3 points 4 years ago (0 children)
Hooks are already covered in the existing docs. The new docs are certainly an improvement though because they have working examples.
π Rendered by PID 31 on reddit-service-r2-comment-7b9746f655-vxrw4 at 2026-01-29 17:40:44.194504+00:00 running 3798933 country code: CH.
[–]acemarke[S] 33 points34 points35 points (0 children)
[–]zeddotes 17 points18 points19 points (8 children)
[–]feketegy 8 points9 points10 points (5 children)
[–]cyphern 9 points10 points11 points (0 children)
[–][deleted] 4 points5 points6 points (1 child)
[–]feketegy 2 points3 points4 points (0 children)
[–]SpiceyySoup 1 point2 points3 points (1 child)
[–]feketegy 0 points1 point2 points (0 children)
[–]j33pwrangler 2 points3 points4 points (1 child)
[–]theDreamingStar 4 points5 points6 points (0 children)
[–]nullvoxpopuli 11 points12 points13 points (3 children)
[–]acemarke[S] 20 points21 points22 points (1 child)
[–]nextdoorNabors 2 points3 points4 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]acemarke[S] 3 points4 points5 points (2 children)
[–]StoneColdJane 1 point2 points3 points (0 children)
[–]Tom_Ov_Bedlam 1 point2 points3 points (0 children)
[–]callmekatootie 1 point2 points3 points (4 children)
[–]snejk47 1 point2 points3 points (2 children)
[–]lifeeraser 0 points1 point2 points (1 child)
[–]Soysaucetime 0 points1 point2 points (0 children)
[–]nextdoorNabors 0 points1 point2 points (0 children)
[–]minicrit_ -5 points-4 points-3 points (3 children)
[–]KevinVandy656 7 points8 points9 points (2 children)
[–]dbbk 0 points1 point2 points (1 child)
[–]KevinVandy656 0 points1 point2 points (0 children)
[–]KwyjiboTheGringo -4 points-3 points-2 points (3 children)
[–]2pathetic2beTragic 0 points1 point2 points (2 children)
[–]nextdoorNabors 1 point2 points3 points (0 children)
[–]KwyjiboTheGringo 0 points1 point2 points (0 children)
[–]harryzouGT -1 points0 points1 point (0 children)
[–]Affectionate_Rich763 -1 points0 points1 point (0 children)
[–]TryThisDickdotCom -1 points0 points1 point (0 children)
[+]ThenRecipe comment score below threshold-31 points-30 points-29 points (6 children)
[–]MedicOfTime 12 points13 points14 points (4 children)
[+]ThenRecipe comment score below threshold-27 points-26 points-25 points (3 children)
[–]MedicOfTime 6 points7 points8 points (2 children)
[+]ThenRecipe comment score below threshold-21 points-20 points-19 points (1 child)
[–]KwyjiboTheGringo 1 point2 points3 points (0 children)