Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react-drag-drop-files open twice

//Put it in a function (worked for me)
function DragDrop() {
  const [file, setFile] = useState(null);
  const handleChange = file => {
    setFile(file);
  };
  return (
    <FileUploader 
        handleChange={handleChange} 
        name="file" 
    />
  );
}

//And call it e.g.
return (
	...
    <DragDrop/>
    ...
)
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #open
ADD COMMENT
Topic
Name
2+1 =