reactjs / reactjs/react.dev

Suggest improving hook API reference signatures

Open
#1,825 0 comments 3 reactions 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

A user on Reddit pointed out that the Hooks API Reference page section for useEffect doesn't include the deps array in the signature - it's just useEffect(callback). The deps array is only described later on under the heading "Conditionally Firing an Effect".

Similarly, the entry for useLayoutEffect() doesn't even show a signature at all - it just says "the signature is identical to useEffect".

At a minimum, the useEffect signature should show that there's an optional second argument - the deps array. It would also help to show the signature for useLayoutEffect as well.

Reddit link reference: https://www.reddit.com/r/reactjs/comments/b0oh20/usedimensions_a_react_hook_to_measure_dom_nodes/eigiqud/

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 with the Hooks API Reference page and inspect the useEffect and useLayoutEffect entries. The work is done when useEffect shows its optional deps array and useLayoutEffect has an explicit signature, with the surrounding explanations remaining consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.