17
26

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【React】Error: Objects are not valid as a React child (found: object with keys {label, value}). If you meant to render a collection of children, use an array instead.

Posted at

エラー対応の個人的な備忘録です。

やりたいこと

  • DOM要素をループさせて、リスト表示させたい

エラーメッセージ

Error: Objects are not valid as a React child (found: object with keys {label, value}). 
If you meant to render a collection of children, use an array instead.

原因

  • オブジェクトそのものを表示しようとしたため、エラーになった
  • リファクタ時に分割代入していた箇所が漏れてしまい、表示時にオブジェクトそのものになってしまっていた

解決方法

  • {obj} ではなく {obj.title} で表示するようにする
17
26
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
17
26

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?