reactjs / reactjs/react.dev

[Typo]: explanation of useMemo first-render return value, doesn't make logical sense

Open
#7,752 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

Inconsistent explaining on what useMemo returns on first render.

Page

https://react.dev/reference/react/useMemo#reference

Details

From article, in order:

On the initial render, useMemo returns the result of calling calculateValue with no arguments.

On the initial render, the value you’ll get from useMemo will be the result of calling your calculation.

The first sentence, to me does not make sense, as calculateValue is called with arguments, it's just that dependencies don't factor in yet on first render.
Or my bad sorry:)

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 useMemo reference page at the linked section and compare the two descriptions of the initial render. Confirm how the calculation is called and revise the inconsistent wording so it is logically accurate; done when the explanation no longer implies that arguments are omitted.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.