Skip to content

Instantly share code, notes, and snippets.

@sunguru98
Created December 23, 2019 10:06
Show Gist options
  • Save sunguru98/bc478ac19d3ceb9a3fda23d88fbf6849 to your computer and use it in GitHub Desktop.
Save sunguru98/bc478ac19d3ceb9a3fda23d88fbf6849 to your computer and use it in GitHub Desktop.
Markdium-Build an OCR/Image Search application with MERN Stack
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