Skip to main content
Version: 3.xx.xx
Swizzle Ready

Refresh

<RefreshButton> uses Mantine <Button> component to update the data shown on the page via the useOne method provided by your dataProvider.

Swizzle

You can swizzle this component to customize it with the refine CLI

Usage

localhost:3000/posts/show/123
Live previews only work with the latest documentation.
import { useShow } from "@pankod/refine-core";
import {
Show,
Title,
Text,
MarkdownField,
RefreshButton,
} from "@pankod/refine-mantine";

const PostShow: React.FC<IResourceComponentsProps> = () => {
const { queryResult } = useShow<IPost>();
const { data, isLoading } = queryResult;
const record = data?.data;

return (
<Show headerButtons={<RefreshButton />} isLoading={isLoading}>
<Title order={5}>Id</Title>
<Text mt="sm">{record?.id}</Text>

<Title mt="sm" order={5}>
Title
</Title>
<Text mt="sm">{record?.title}</Text>

<Title mt="sm" order={5}>
Content
</Title>
<MarkdownField value={record?.content} />
</Show>
);
};

Properties

recordItemId

recordItemId allows us to manage which data is going to be refreshed.

localhost:3000
Live previews only work with the latest documentation.
import { RefreshButton } from "@pankod/refine-mantine";

const MyRefreshComponent = () => {
return <RefreshButton recordItemId="123" />;
};

Clicking the button will trigger the useOne method and then fetches the record whose resource is "post" and whose id is "123".

NOTE

<RefreshButton> component reads the id information from the route by default.

resourceNameOrRouteName

resourceNameOrRouteName allows us to manage which resource is going to be refreshed.

localhost:3000
Live previews only work with the latest documentation.
import { RefreshButton } from "@pankod/refine-mantine";

const MyRefreshComponent = () => {
return (
<RefreshButton resourceNameOrRouteName="categories" recordItemId="2" />
);
};

Clicking the button will trigger the useOne method and then fetches the record whose resource is "categories" and whose id is "2".

NOTE

<RefreshButton> component reads the resource name from the route by default.

hideText

It is used to show and not show the text of the button. When true, only the button icon is visible.

localhost:3000
Live previews only work with the latest documentation.
import { RefreshButton } from "@pankod/refine-mantine";

const MyRefreshComponent = () => {
return <RefreshButton hideText recordItemId="123" />;
};

API Reference

Properties