React-hook-form fields based on API call.
I hit an API to get fields for a product. The field properties usually get defined before with Zod. The problem is if the API got changed it won't be in sync.
Example of the res data:
categoryAttributes.index.attribute.name should be the field name I suppose but how can I assign it to react-hook-form. I can't tell the name or if it required so I can make it as required in the form since it is an API call. I know the shape of the response only.
Is there a way around or I need to hard type them in the zod scheme and react-hook-form?
Example of the res data:
categoryAttributes.index.attribute.name should be the field name I suppose but how can I assign it to react-hook-form. I can't tell the name or if it required so I can make it as required in the form since it is an API call. I know the shape of the response only.
Is there a way around or I need to hard type them in the zod scheme and react-hook-form?
