reactjs / reactjs/react.dev

Don't quite see using index as key has problems?

オープン
#2,752 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

説明

On page https://reactjs.org/docs/reconciliation.html
it is said that

Here is an example of the issues that can be caused by using indexes as keys on CodePen

How can the issue be created? I added record to the front, to the back, and sort them, and they seemed to work ok?

Actually, here is a simple case and I can't break it: https://stackoverflow.com/questions/60283967/in-reactjs-using-array-index-as-key-is-said-to-not-work-well-but-i-cant-make

I can only break it if it is all 3 conditions:
It has to be function component using useState, and I have to mutate the state (which the docs says I shouldn't do), and use index as key. So if I don't mutate the state, I can't make it not work well if I use index as key.

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

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

はじめの一歩

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

調査の方向性

reconciliation のドキュメントページと、そこからリンクされている CodePen の例から始め、報告された動作をリンクされている Stack Overflow のケースと比較します。例または説明に明確化が必要かどうかを判断し、再現可能なケース、または現在の例が引き続き有効である理由を正確に説明できていれば、ドキュメントは完成したものとみなします。

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

評価

技術スタック
javascript, react
領域
documentation
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

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

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