correct-apricot•2y ago
Can Show and Edit components pass custom meta to the buttons ?
Is it possible to pass meta to the buttons, besides rewriting the entire rendering ?
What I am doing now is the following;
But this is so redundant and verbose, is there an easier way ?
2 Replies
Hi @i.stoica. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, it is possible to pass additional parameters or override the existing ones using the
meta prop in both Show and Edit components. This is done through the show and edit methods of useNavigation.
For example, if the show action route is defined by the pattern: /posts/:authorId/show/:id, the meta prop can be used as follows:
Similarly, if the edit action route is defined by the pattern: /posts/:authorId/edit/:id, the meta prop can be used as follows:
However, based on the discussion in the Github issue (https://github.com/refinedev/refine/issues/3829), it seems that the Refine team is considering adding separate props for each button to support separate values rather than a single meta. This would allow you to pass different meta values to different buttons.
As of now, your current approach of passing meta to each button individually seems to be the recommended way.
For more information, you can refer to the documentation for ShowButton (https://refine.dev/docs/ui-integrations/ant-design/components/buttons/show-button#meta) and EditButton (https://refine.dev/docs/ui-integrations/material-ui/components/buttons/edit-button#meta).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@180601470268211200> kapa.ai is still learning and improving, please let us know how it did by reacting below