sour-pinkS
Refine2y ago
17 replies
sour-pink

How can I change data before initializing the form in Edit scenario

Hello, I am currently switching from react-admin and I am loving Refine so far.

I am looking to the the reverse of "How can I change the form data before submitting it to the API" which is shown here. https://refine.dev/docs/packages/react-hook-form/use-form/#how-can-i-change-the-form-data-before-submitting-it-to-the-api

In Edit scenario, (I am using Edit from @refinedev/mui), my API is returning a field called dueDate which is string but I have to turn it into a Dayjs to to initialize the DatePicker properly. Also, there might be other cases for transforming the data coming from the API before the form can be initialized. Any pointers will be appreciated.
useForm is used to manage forms. It returns the necessary properties and methods to control the element. It has been developed by using useForm imported from the @refinedev/core package.
useForm | Refine
Was this page helpful?