Use redirect(), there is an example in the documentation: https://marmelab.com/react-admin/Actions.html#handling-side-effects-in-other-hooks
import * as React from "react";
import { useMutation, useNotify, useRedirect, Button } from 'react-admin';
const ApproveButton = ({ record }) => {
const notify = useNotify();
const redirect = useRedirect();
const [approve, { loading }] = useMutation(
{
type: 'update',
resource: 'comments',
payload: { id: record.id, data: { isApproved: true } },
},
{
onSuccess: ({ data }) => {
redirect('/comments');
notify('Comment approved');
},
onFailure: (error) => notify(`Comment approval error: ${error.message}`, 'warning'),
}
);
return <Button label="Approve" onClick={approve} disabled={loading} />;
CLICK HERE to find out more related problems solutions.