Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the documentation-only clarification of how dependency values are compared.
No open issues 🎉
What changed in this PR
React の日本語リファレンスで、useMemo と useCallback の依存値比較の説明を明確にします。ドキュメントのみの変更で、実装やコード例は変わりません。
Changes:
Object.isの比較対象が、依存配列自体ではなく、前回と今回の対応する各依存値であることを明記。- キャッシュについての要約を「依存値」が変わるまでという表現に統一。
| File | Description |
|---|---|
src/content/reference/react/useMemo.md |
依存値の比較と計算結果のキャッシュに関する説明を修正。 |
src/content/reference/react/useCallback.md |
依存値の比較と関数のキャッシュに関する説明を修正。 |
Review effort: Balanced
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
useMemoとuseCallbackの使用法で、Object.isの比較対象が依存配列そのものだと読める説明を修正します。例えば、
[todos, tab]はレンダーのたびに新しい配列になりますが、各依存値が変化しなければキャッシュは再利用されます。現在の訳文では「依存配列と、前回の依存配列が比較されます」「依存配列が変更されていない場合」と説明しており、配列の参照同一性で判定されるという誤解につながる可能性があります。両ページで、配列内の各依存値を前回の対応する依存値と比較することを明記します。直後の要約も「依存値」が変わるまでキャッシュするという表現に揃えます。これは英語原文の “none of the dependencies have changed” と、同ページの引数リファレンスにある説明に沿った修正です。
英語原文:
検証:
git diff --check:成功ブラウザ上の表示確認は未実施です。