1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【React】キーは問題ないはずなのにEach child in a list should have a unique "key" prop.

1
Posted at

はじめに

  • apiからデータフェッチして既存処理のinitialStateに登録していた

問題

  • キーとして使っているプロパティも問題なく存在するデータなのに、表題のエラーが出る

解決

  • initialStateとして使用するArrayのデータが、 const [hoge, setHoge] = useState([fetchDateArray])のようにして配列が二重になっていた
  • const [hoge, setHoge] = useState(fetchDateArray)として解決

終わりに

  • 公式docと実際のコード読み込みやドメイン知識のおさらいで大体解決する
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?