2 Replies
Hi @viveksingh0143. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To trigger another function when data is loaded using the
useForm
hook in refine, you can utilize the React.useEffect
hook to watch for changes in the query
result. When the data is successfully fetched, you can call your desired function.
Here's an example of how you can achieve this:
In this example:
- The useForm
hook is used to fetch the data for the edit
action.
- The React.useEffect
hook is used to watch for changes in the record
variable, which holds the fetched data.
- When record
is updated with the fetched data, the myFunction
function is called with the loaded data.
This approach ensures that your custom function is triggered whenever the data is successfully loaded.
For more information, you can refer to the useForm documentation (https://refine.dev/docs/data/hooks/use-form/#usage).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@940119979334967366> kapa.ai is still learning and improving, please let us know how it did by reacting below