React-Admin编辑组件不起作用

发布于 2025-01-22 11:58:22 字数 784 浏览 2 评论 0原文

我一直在关注

app.js中

<Admin dataProvider={dataProvider} authProvider={authProvider}>
    <Resource name="users" list={ UserList } layout={ MyLayout } edit={UserEdit} create={UserCreate} />
  </Admin>

在userlist.js中的

export const UserEdit = (props) => {
  <Edit  {...props}>
    <SimpleForm>
      <ReferenceInput source="id" reference="users">
        <SelectInput optionText="id" />
      </ReferenceInput>
      <TextInput source="firstName" />
      <TextInput source="lastName" />
      <TextInput source="email" />
      <TextInput source="organization" />
      <TextInput source="status" />
    </SimpleForm>
  </Edit>
}

I have been following the tutorial on react-admin and when I get to the part where you have to edit, a user for instance, the edit page shows up black with no errors in the devtool window. Please have a look at my code. Where am I going wrong?

in App.js

<Admin dataProvider={dataProvider} authProvider={authProvider}>
    <Resource name="users" list={ UserList } layout={ MyLayout } edit={UserEdit} create={UserCreate} />
  </Admin>

in UserList.js

export const UserEdit = (props) => {
  <Edit  {...props}>
    <SimpleForm>
      <ReferenceInput source="id" reference="users">
        <SelectInput optionText="id" />
      </ReferenceInput>
      <TextInput source="firstName" />
      <TextInput source="lastName" />
      <TextInput source="email" />
      <TextInput source="organization" />
      <TextInput source="status" />
    </SimpleForm>
  </Edit>
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

巴黎夜雨 2025-01-29 11:58:22

您在这里有问题:

&lt; resource name =“用户” list = {userList} layout = {mylayout} edit = {userEdit} create = {usercreate}/&gt;

layout 是admin prop,它不应在资源

You have a problem here:

<Resource name="users" list={ UserList } layout={ MyLayout } edit={UserEdit} create={UserCreate} />

layout is an Admin prop, It shouldn't be in a Resource

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文