首页 > 其他分享 >前端项目实战壹佰柒拾伍react-admin+material ui-react-admin之Create之更改通知消息

前端项目实战壹佰柒拾伍react-admin+material ui-react-admin之Create之更改通知消息

时间:2023-08-21 11:34:03浏览次数:37  
标签:壹佰柒 const admin Create react notify data


我是歌谣 微信公众号关注前端小歌谣

import * as React from 'react';
import { useNotify, useRedirect, Create, SimpleForm } from 'react-admin';

const PostCreate = () => {
    const notify = useNotify();
    const redirect = useRedirect();

    const onSuccess = (data) => {
        notify(`Post created successfully`); // default message is 'ra.notification.created'
        redirect('edit', 'posts', data.id, data);
    };

    return (
        <Create mutationOptions={{ onSuccess }}>
            <SimpleForm>
                ...
            </SimpleForm>
        </Create>
    );
}

标签:壹佰柒,const,admin,Create,react,notify,data
From: https://blog.51cto.com/u_15460007/7173062

相关文章