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 set images by default in value #87

Closed esdras-assikid closed 2 years ago

esdras-assikid commented 3 years ago

I need to made a modify page so i fetch image from api and i want to set it by default in value of the ImageUploading componement. I get this error : Uncaught TypeError: Failed to construct 'Image': Please use the 'new' operator, this DOM object constructor cannot be called as a function. Is there a way to set images by default for ImageUploading ?

vutoan266 commented 3 years ago

Hi @esdras-assikid, You could set an initial image list like this (react hook example):

const [images, setImages] = useState([
   { dataURL: your_init_image_url_1 },
   { dataURL: your_init_image_url_1 },
   ...
]);

Thanks!