reactjs / reactjs/react.dev

Docs - sample code updates needed?

Open
#2,031 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

There seems to be confusion on how to write class components in the docs. Using this as a starting point for other pages which may need to be updated.

There is a mixture of function declaration and class components in the docs which can be confusing as when someone may want or need to use either method. Since the release of hooks, the docs should have a new site version release (similar to how Babel has site versions) with the updated, preferred way to write components backed by the core team.

in CONTRIBUTING.md, it shows that you should write classes with a constructor, but the Blog post titled "Update on Async Rendering" seems to prefer the former method of writing components.

Can this be solidified and added to the docs where necessary? Will there be a need to have a new site version with focus on function declaration components?

🥇

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the class-component guidance in CONTRIBUTING.md with the "Update on Async Rendering" blog post, then inventory the affected documentation pages. Confirm the core team's preferred guidance and whether a new site version is needed; the work is done when the guidance and necessary examples are consistently updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.