Imageuploader not resetting after images are uploaded
When images are uploaded, i am sending back empty array to set selected images to [], but even as the selected images have become [] they are showing in the preview.
For the ones searching for a quick fix..
Add an ref to your component
<ImageUploader ref={this.myRef}
In your constructor:
this.myRef = React.createRef();
In the function which will be called after success upload:
this.setState({pictures: []}); this.myRef.current.state.pictures = [];
So I was able to find a workaround. The reference has its own state that can be accessed.
const imageUploadRef = useRef(null);
<ImageUploader ref={imageUploadRef} ... />
Reset all uploads after onChange call
imageUploadRef.current.state.pictures = [];
imageUploadRef.current.state.files = [];