Skip to main content
Version: 2.xx.xx


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​

resourceWithRoute(route: string) => IResourceItem


interface IResourceItem {
name: string;
label?: string;
route?: string;
icon?: ReactNode;
canCreate?: boolean;
canEdit?: boolean;
canShow?: boolean;
canDelete?: boolean;

The canCreate, canShow and canEdit properties are defined automatically if the create, show and edit components are defined on the resources property in <Refine>.