React-Admin编辑组件不起作用
我一直在关注
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在这里有问题:
&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 anAdmin
prop, It shouldn't be in aResource