hygraph / hygraph-commerce-starter

https://commerce.withheadlesscms.com
MIT License
171 stars 66 forks source link

Data empty in onSubmit function #24

Closed lsbyerley closed 3 years ago

lsbyerley commented 3 years ago

Thanks for the great tutorial and setup. I've been setting this up locally and for some reason the data object is empty in the onSubmit function in the form when submitting a review. Any clues as to why?

https://github.com/GraphCMS/graphcms-commerce-starter/blob/9ef066a162afdf18d904545764f807d2550b7822/components/product-review-form.js#L22

I am on the latest versions of react-hook-form and next.. maybe there is a change i'm not aware of?

lsbyerley commented 3 years ago

Turns out, this is because of different versions of react-hook-form. The register function is different in v7 vs. v6

https://react-hook-form.com/migrate-v6-to-v7/