This is my code uploader
const MyUploader = ({ imageData }) => {
// specify upload params and url for your files
const getUploadParams = ({ meta, file }) => {
return { url: "https://httpbin.org/post" };
};
const handleChangeStatus = ({ meta, file }, status) => {
// console.log(meta.previewUrl);
const reader = new FileReader();
reader.onabort = () => console.log('file reading was aborted')
reader.onload = (event) => {
// console.log(event.target.result);
if (status === "done") {
imageData(event.target.result);
}
};
reader.readAsDataURL(file);
};
// receives array of files that are done uploading when submit button is clicked
const handleSubmit = (files, allFiles) => {
allFiles.forEach((f) => f.remove());
};
return (
<Dropzone
getUploadParams={getUploadParams}
onChangeStatus={handleChangeStatus}
onSubmit={handleSubmit}
onDelete={(file) => console.log(file, "Helo")}
accept="image/*"
/>
);
};
<MyUploader
imageData={(data) =>
setFormData({
...formData,
images: [...formData.images, data],
})
}
/>
But when I insert file is fine, but when I remove my preview the array won't remove , like image below:
How to remove that?