awake-maroonA
Refine11mo ago
19 replies
awake-maroon

Modify data after fetching and before submitting with `useForm`

I have two types FormType and ApiType. My form uses FormType, while my data provider uses ApiType. How do I handle this using
useForm
?

Specifically, my data provider returns objects of ApiType. However, my form does not follow this type, but instead requires a mutation apiToForm: (data: ApiType) => FormType) to transform from ApiType to FormType. On submitting, the transformation formToApi: (formData: FormType) => ApiType should be done.

I am using AntDesign, but am open to a solution using any design system.
Was this page helpful?