Uploading images to cloudinary via Nextjs + React-Hook-Form + Zod

Pedro_Souza
Pedro_Souza Member Posts: 4
edited July 9 in Tips, Tricks, and Guides

Hi, after resolving a problem with my next app, i decided to make a quick tutorial from what i have done, making it clear that this can be not the best example, its just a test.

I used React-Dropzone to catch values and React-Hook-Form to handle my form (that contains name, description and an optional array of images):

(i will skip react-dropzone cause its not the actual meaning of this post).

after that, i create a function to recieve the array and send it to Cloudinary:

I call this function in my react-hook-form submit function (with the help of ZodProvider):

This function is responsable to make the call from next js project route:

And this function in the next api:

Hope you liked this quick tutorial

Comments