Show get resource
I am trying to dynamically get the resource name of which current show/edit/list page
how can I achieve this ?
2 Replies
Hi @koop_g. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To dynamically get the resource name of the current show/edit/list page in refine, you can use the
useResource
hook. This hook allows you to retrieve information about the current resource based on the route.
Here's how you can use it:
The useResource
hook returns an object that includes the resource
property. This resource
object contains information about the current resource, including its name
.
By using this hook, you can dynamically access the resource name regardless of whether you're on a show, edit, or list page. The hook automatically infers the resource information from the current route.
For more detailed information and additional use cases, you can refer to the useResource API Reference.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1327562833537400895> Kapa.ai is still learning and improving, please let me know how I did by reacting below.