reactjs / reactjs/react.dev

Better to mention closure here

Open
#6,294 0 comments 0 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

In https://react.dev/learn/state-as-a-snapshot#state-over-time

It is said that

The state stored in React may have changed by the time the alert runs, but it was scheduled using a snapshot of the state at the time the user interacted with it!

it is better to indicate that technically, it is due to closure, so that people who understand closure and know it is due to that, or to people who don't understand closure, get some exposure to closure.

The phrase "it was scheduled using a snapshot of the state at the time the user interacted with it!" is cool, but ultimately, it is closure that explains it.

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

Open the State as a Snapshot page at the linked “State Over Time” section and read the surrounding explanation of the alert example. Revise the wording to mention the role of closures while retaining the snapshot explanation, then check that the updated text remains clear for readers with different levels of JavaScript knowledge.

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
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.