Create Modal ID access?
Hi,
I have a create modal that I need to pass an ID to; I've done so, and its in the query parameter --
/books?modal-books-create[open]=true&modal-books-create[id]=10
How could I access it inside the AntD Modal?2 Replies
Hi @avangeous. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
You can access the ID inside the AntD Modal using the
useModalForm
hook provided by Refine. This hook returns a set of properties, one of which is id
that represents the record id for the edit action.
Here is an example of how you can use it:
In this example, id
is the record id for the edit action. You can use this id
inside your modal.
For more information, you can refer to the useModalForm documentation (https://refine.dev/docs/api-reference/antd/hooks/form/useModalForm).
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@1122927158348763206> kapa.ai is still learning and improving, please let us know how it did by reacting below