reactjs / reactjs/react.dev

[Typo]: Code example mistake in useMemo page

オープン 初心者向け
#7,252 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

type: typos
主要言語
JavaScript
スター
11.8k
フォーク
7.9k
平均マージ
1日 11時間
マージ済み PR(30日)
11

説明

Summary

There is a mistake in the ChatRoom example code on the useMemo page, specifically in the 'Preventing an Effect from firing too often' section.

Page

https://react.dev/reference/react/useMemo#preventing-an-effect-from-firing-too-often

Details

There are two mistakes in the ChatRoom example under the 'Preventing an Effect from firing too often' section:

  1. The line const options = createOptions() suddenly appears in the code without context. It seems like this should be removed.
  2. In the comment 'Only changes when createOptions changes', the reference to 'createOptions' should be replaced with 'options object'. This is because options is the actual dependency in the useEffect.

Screenshot of typo:
스크린샷 2024-10-24 오후 7 28 57

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

React useMemoのリファレンスページを「Preventing an Effect from firing too often」セクションで開き、ChatRoomの例を確認してください。余分なcreateOptions行と依存関係のコメントを確認し、そのうえで例が自己完結しており、文言がoptionsオブジェクトを正確に説明していることを検証してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, react
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
65/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。