inland-turquoise
inland-turquoise13mo ago

Passing props to create component

When I click the create button for my resource and it redirects me to that resource, is there a way for me to pass props to it?
3 Replies
kapa.ai
kapa.ai13mo ago
Hi @.chasel. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The extracts provided do not mention the ability to pass props to a resource when redirecting using the CreateButton component in refine. However, the CreateButton component does accept a resource prop which is used to redirect the app to the create action path of the given resource name. When the button is clicked, it triggers the create method of useNavigation and then redirects the app to the create action path of the resource, filling the necessary parameters in the route. Here is an example of how to use the CreateButton component:
import { CreateButton } from "@refinedev/antd";

const MyCreateComponent = () => {
return (
<CreateButton
resource="categories"
/>
);
};
import { CreateButton } from "@refinedev/antd";

const MyCreateComponent = () => {
return (
<CreateButton
resource="categories"
/>
);
};
For more detailed information, you may want to check the refine documentation (https://refine.dev/docs). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai13mo ago
<@196423433930670080> kapa.ai is still learning and improving, please let us how it did by reacting below
inland-turquoise
inland-turquoise13mo ago
@kapa.ai Can I have a resource route nested in another resource's routes?