Open SciSaif opened 1 year ago
I have the same problem too, is there a way to avoid this problem?
I would avoid to add required
as a state if possible.
The code is the same as in the example, i just added the field required
:
import React, { useState } from "react";
import { FileUploader } from "react-drag-drop-files";
const fileTypes = ["JPG", "PNG", "GIF"];
function DragDrop() {
const [file, setFile] = useState(null);
const handleChange = (file) => {
setFile(file);
};
return (
<FileUploader handleChange={handleChange} name="file" types={fileTypes} required />
);
}
export default DragDrop;
Hi, same issue here, wondering if anybody has found a way to deal with this?
If the input is required and we use drag and drop to upload the file, then on form submit, it says field is required even if the file is uploaded, so it doesn't let me submit. right now I am handling the required part manually.