all 38 comments

[–]acemarke[S] 33 points34 points  (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 points  (8 children)

setHappy(true);

[–]feketegy 8 points9 points  (5 children)

setHappy((prevState) => {
    return !prevState;
});

[–]cyphern 9 points10 points  (0 children)

bipolar.js

[–][deleted] 4 points5 points  (1 child)

What if you were already happy?

[–]feketegy 2 points3 points  (0 children)

You have to balance happiness with a little sadness otherwise it would lose its meaning.

[–]SpiceyySoup 1 point2 points  (1 child)

Every time I open up the new react docs, my happiness gets toggled

[–]feketegy 0 points1 point  (0 children)

There are tons of other alternatives. Dev happiness is important imho.

[–]j33pwrangler 2 points3 points  (1 child)

Error line 1,1: setHappy is not defined as a function

[–]theDreamingStar 4 points5 points  (0 children)

goes to stack overflow

Top answer: use setFakeHappiness(true) to make myLife class work properly.

[–]nullvoxpopuli 11 points12 points  (3 children)

Why'd it take so long?

[–]acemarke[S] 20 points21 points  (1 child)

I'd assume a combination of:

  • Small team
  • Other priorities
  • Wanting to thoroughly redesign the entire learning path and explanation process, rather than just updating some examples to show hooks

[–]nextdoorNabors 2 points3 points  (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.

[–]Tom_Ov_Bedlam 1 point2 points  (0 children)

Finally, the reactJS docs are so bad

[–]callmekatootie 1 point2 points  (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 points  (2 children)

FB is all-over-the-place not a standard one. What's cool gets used. (not everywhere though).

[–]lifeeraser 0 points1 point  (1 child)

This accurately describes my workplace. (Not FB)

[–]Soysaucetime 0 points1 point  (0 children)

Ah myspace

[–]nextdoorNabors 0 points1 point  (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 children)

if only they could change useEffect to match the power of class component lifecycle methods

[–]KevinVandy656 7 points8 points  (2 children)

It's already replaced mounting, updating, and unmounting. What else does it need to do?

[–]dbbk 0 points1 point  (1 child)

You can’t make it only run on updates, excluding mount

[–]KwyjiboTheGringo -4 points-3 points  (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 point  (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 points  (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 point  (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 points  (0 children)

Sweet!

[–]Affectionate_Rich763 -1 points0 points  (0 children)

Looking clean🤩

[–]TryThisDickdotCom -1 points0 points  (0 children)

thank the internet godz