MyDropzone does work

This commit is contained in:
aronmal 2022-11-09 21:44:19 +01:00
parent f3c3f15f3a
commit 572340d5bd
Signed by: aronmal
GPG key ID: 816B7707426FC612
4 changed files with 87 additions and 2 deletions

View file

@ -2,7 +2,8 @@
// import Homepage from './components/Homepage';
// import Homepage2 from './components/Homepage2';
// import SocketIO from './components/SocketIO';
import Upload from './components/Upload';
// import Upload from './components/Upload';
import MyDropzone from './components/MyDropzone';
import './styles/App.scss';
function App() {
@ -15,7 +16,8 @@ function App() {
{/* <Homepage/> */}
{/* <Homepage2/> */}
{/* <SocketIO/> */}
<Upload />
{/* <Upload /> */}
<MyDropzone />
</header>
</div>
);

View file

@ -0,0 +1,23 @@
import {useCallback} from 'react'
import {useDropzone} from 'react-dropzone'
function MyDropzone() {
const onDrop = useCallback((acceptedFiles: any) => {
// Do something with the files
console.log(acceptedFiles)
}, [])
const {getRootProps, getInputProps, isDragActive} = useDropzone({onDrop})
return (
<div {...getRootProps()}>
<input {...getInputProps()} />
{
isDragActive ?
<p>Drop the files here ...</p> :
<p>Drag 'n' drop some files here, or click to select files</p>
}
</div>
)
}
export default MyDropzone