Created
December 23, 2019 10:06
-
-
Save sunguru98/bc478ac19d3ceb9a3fda23d88fbf6849 to your computer and use it in GitHub Desktop.
Markdium-Build an OCR/Image Search application with MERN Stack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { getRootProps, getInputProps, isDragActive, isDragAccept, isDragReject } = useDropzone({ | |
multiple: true, | |
accept: 'image/jpeg, image/png', | |
maxSize: 1024 * 1024 * 2, | |
minSize: 0, | |
onDrop: acceptedFiles => { | |
setFiles([ | |
...acceptedFiles.slice( | |
0, | |
acceptedFiles.length > 2 ? 2 : acceptedFiles.length | |
) | |
]) | |
setPreviews( | |
acceptedFiles | |
.map(file => URL.createObjectURL(file)) | |
.slice(0, acceptedFiles.length > 2 ? 2 : acceptedFiles.length) | |
) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment