useResourceWithRoute
useResourceWithRoute
is used to get the properties of a resource defined as a element of the resources
. It returns a function and this function allows us to access the resource with the route
option we gave to the resource.
The hook is used internal in refine. Normally you don't need this hook, but we export it as it may be useful for some use-cases.
import { useResourceWithRoute } from "@pankod/refine";
const resourceWithRoute = useResourceWithRoute();
API Reference
Return value
Description | Type |
---|---|
resourceWithRoute | (route: string) => IResourceItem |
Interfaces
interface IResourceItem {
name: string;
label?: string;
route?: string;
icon?: ReactNode;
canCreate?: boolean;
canEdit?: boolean;
canShow?: boolean;
canDelete?: boolean;
}
The
canCreate
,canShow
andcanEdit
properties are defined automatically if thecreate
,show
andedit
components are defined on theresources
property in<Refine>
.