且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在React中显示表中的对象数组

更新时间:2023-01-16 09:49:05

对象无效,不能作为React子对象

Objects are not valid as a React child

这意味着您传递了一个对象,而不是React可以反序列化的对象;例如字符串或数字.

It means that you passed an Object instead of something that React can deserialize; string for example, or a number.

首先,您必须将唯一的内容(不是数组索引)传递给 key = {} . itemID 会很好.

First of all, you have to pass to key={} something that is unique (not an array index). itemID would be nice.