我使用useQuery来显示列表项,我需要按钮来刷新我的请求如何使用useRefresh来完成这项工作?
这是我的代码:
const {data,total,loading,error} = useQuery({
type: 'GET_LIST',
resource: 'requests',
payload: {
pagination: { page: page, perPage: perPage },
sort: { field: 'createdAt', order: 'DESC' },
filter: {restaurants_id:restaurants_id,createdAt:date}
}
});
试试这个:
import { useRefresh } from 'react-admin';
...
const refresh = useRefresh();
...
refresh();