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

Replace existing image with the newly selected one. #102

Closed Gunner17 closed 2 years ago

Gunner17 commented 3 years ago

Hi all,

I want to allow users upload one image at a time and also, when user selects/uploads a new image, if there is any previously selected image present, then that should get replaced with the new one. Is there any way to achieve that?

Thanks in advance.

vutoan266 commented 3 years ago

Hi @Gunner17,

Sure you can do that. By the way set maxNumber = 1, when the user uploads the first image, use onImageUpload function, then latter uploading times, use () => onImageUpdate(0) to replace on the first one.

Hope it is helpful for you!