I am using simple Drag and Drop function via Dropzone but Somehow having this error of "Warning: Failed prop type: Invalid prop children
of type string
supplied to Dropzone
, expected function
." I have no idea what it is Na d I have checked the problem doesn't lie anywhere else other than this page
import React, { Component } from "react";
import Dropzone from "react-dropzone";
const MaxSize = 1000000000; //
class DragAndDrop extends Component {
handleOnDrop = (files, rejectedFiles) => {
console.log(files);
console.log("rejected files are:", rejectedFiles);
if (rejectedFiles && rejectedFiles.length > 0) {
const currentRejectFile = rejectedFiles[0];
const currentRejectFileType = currentRejectFile.type;
const currentRejectFileSize = currentRejectFile.size;
if (currentRejectFileSize > MaxSize) {
alert(
"This file is not allowed. " +
currentRejectFileSize +
currentRejectFileType +
" too large"
);
}
}
if (files && files.length > 0) {
const currentFile = files[0];
const currentFileType = currentFile.type;
const currentFileSize = currentFile.size;
if (currentFileSize > MaxSize) {
alert(
"This file is not allowed. " +
currentFileSize +
currentFileType +
" too large"
);
}
}
};
render() {
return (
<div>
<h1>Drop </h1>
<Dropzone
onDrop={() => this.handleOnDrop()}
multiple={false}
maxSize={MaxSize}
>
Drop image here or click to upload
</Dropzone>
</div>
);
}
}
export default DragAndDrop;
What I want is a simple drap and drop or select and push some image