reactjs / reactjs/react.dev

Missing info about changes in StrictMode discoverable through useEffect docs

Open
#4,649 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

This ticket was originally reported in the React issue as a potential bug: https://github.com/facebook/react/issues/24502

After a short discussion with @gaearon I volunteered to update the docs so that once someone learns about empty dependencies array in useEffect simulating componentDidMount they won't be surprised to see effect callback run twice on mount.

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 useEffect documentation and the linked React issue 24502, then review how StrictMode behavior is described around effects with an empty dependency array. Done means the documentation clearly warns that the effect callback may run twice on mount in StrictMode, so readers are not surprised.

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.