我不明白这个错误信息引起的。
我的组件有两个和一个包含对象的数据数组。
我收到一条错误消息“不要object
用作类型。该object
类型目前难以使用'。
我该如何解决?
我附上了数组有对象的数据。
first.tsx...
import { dataList } from './xxx';
// This dataList ===
export const dataList = [
{
id: 1,
title: "text",
hidden1: "text",
},
{
id: 2,
title: "text",
hidden1: "text",
hidden2: "text",
},
{
id: 3,
title: "text",
hidden1: "text",
hidden2: "text",
hidden3: "text",
},
];
const First = () => {
return <Second data={dataList} />
}
second.tsx...
const Second = ({data} : { data:object[] } ) => {. << …
Run Code Online (Sandbox Code Playgroud)