【发布时间】:2020-06-29 18:29:27
【问题描述】:
所以在文档中它说只是在带有 onSuccess / onFailure 函数的编辑组件上添加一个道具,我已经这样做了,但是导航到要编辑的页面会引发如下错误:
Warning: Unknown event handler property `onSuccess`. It will be ignored.
代码在这里:
export const AffiliateEdit = (props) => {
const notify = useNotify();
const onSuccess = () => {
notify('Affiliate saved successfully');
}
return (
<Edit {...props} onSuccess={onSuccess}>
<SimpleForm redirect="list">
<ColorInput source="color" />
<TextInput source="name" validate={[required()]} />
<ReferenceInput
source="network_id"
reference="networks"
validate={[required()]}
>
<SelectInput optionText="name" />
</ReferenceInput>
<TextInput
source="reference"
validate={[required()]}
helperText="Please use all lower case, no spaces or underscores e.g affiliatename"
/>
</SimpleForm>
</Edit>
)
};
【问题讨论】:
标签: react-admin