vutoan266 / react-images-uploading

The simple images uploader applied Render Props pattern that allows you to fully control UI component and behaviors.
https://github.com/vutoan266/react-images-uploading
MIT License
320 stars 52 forks source link

How to use the both onChange of react-hook-form and onChange of react-images-uploading #110

Closed tinnguyen1296 closed 2 years ago

tinnguyen1296 commented 2 years ago

Hi there, I have upload image field using react-images-uploading and I want to check "required field" from react-hook-form for upload image field. But I cannot use onChange event from two Please help me. Thanks.

tinnguyen1296 commented 2 years ago

Hi there, I have upload image field using react-images-uploading and I want to check "required field" from react-hook-form for upload image field. But I cannot use onChange event from two Please help me. Thanks.

I uploaded codesandbox --> https://codesandbox.io/s/eloquent-lake-j55q9

vutoan266 commented 2 years ago

Hi @tinnguyen1296, have you resolved it? Because this is a Controlled component (it's different with uncontrolled components like .. ) so you need to use Controller component of react-hook-form to wrap react-images-uploading component. you should refer here: https://react-hook-form.com/api/usecontroller/controller

vutoan266 commented 2 years ago

Sorry for my late reply. Hope it is helpful for you, thank you!