reactjs / reactjs/react.dev

Hooks docs: Props usage isn't obvious

Open
#1,775 1 comment 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

Seen this a few times as a bit of a common theme in Reactiflux's #need-help channel. New Hooks users (with only minimal prior React experience) are hitting the Hooks docs, and having some success using basic hooks (e.g., useState), but are missing how "hook components" consume props.

I think there's a bit of an issue of "hook components" not necessarily being recognized as "function components", or users not being familiar with function components to start with.

Looking at the first two pages of hooks docs, we get to the fourth example component before any props are used. I'm (unfortunately) guessing that users aren't reading solidly to that point to see the example.

Proposed solution

Could the intro page's example include using props? Or perhaps a second intro page example which does. I think it needs to be pretty early in the new user's reading flow, before they attempt to write their own component, and before they jump to reading the later pages.

Long term solution

At the moment, I think a large contributing factor is that the Hooks documentation is still mostly standalone from the rest of the docs. I think the combination of newness wearing off, and integration into the "main" docs will eventually solve this problem.

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

Review the first two pages of the Hooks documentation, especially the intro examples and the fourth example component where props first appear. Update an early intro example, or add a second one, so it demonstrates a hook component consuming props and makes the usage clear to new readers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.