调用:参数[object Object]不是函数

时间:2019-11-29 16:50:28

标签: react-admin

我正在使用React-admin,并且正在尝试使用“ jsonplaceholder.typicode”进行测试 当我编译这段代码时

 import { Admin, Resource, ListGuesser } from "react-admin";
import { UserList } from "./users";
const dataProvider = jsonServerProvider("http://jsonplaceholder.typicode.com");

const App = () => (
  <Admin dataProvider={dataProvider}>
    <Resource name="users" list={UserList} />
  </Admin>
);

我遇到此错误“调用:参数[object Object]不是函数”

我的错误是什么? 谢谢

1 个答案:

答案 0 :(得分:0)

使用文档https://github.com/marmelab/react-admin/tree/master/packages/ra-data-json-server中的代码

var lookupKey = new string[] { "Male", "China" };

var lookupData = new List<string[]>();
lookupData.Add(new string[] { "Male", "China" });
lookupData.Add(new string[] { "Male", "America" });
lookupData.Add(new string[] { "Female", "UK" });

List<string[]> output = lookupData;

for (int i = 0; i < 2; i++)
{
   output = output.Where(x => x[i] == lookupKey[i]).ToList();
}