使用 mui-datatables 的人的问题。它将数据作为字符串数组处理,但是无法加载对象数组并出现以下错误:
bundle.js:126379 Uncaught (in promise) TypeError: e.map is not a function
import MUIDataTable from "mui-datatables";
class App extends React.Component {
render() {
const columns = ["Name", "Title", "Location", "Age", "Salary"];
const data = [
{name: "Gabby George", title: "Business Analyst", location: "Minneapolis", age: 30, salary: "$100,000"}
];
const options = {
filterType: 'dropdown',
responsive: 'stacked'
};
return (
<MUIDataTable
title={"ACME Employee list"}
data={data}
columns={columns}
options={options}
/>
);
//return <div>a</div>;
}
}
ReactDOM.render(<App />, document.getElementById("root"));