This file contains hidden or 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 Upload = () => { | |
const [files, setFiles] = useState(null) | |
const inputRef = useRef() | |
const handleClick = () => { | |
inputRef.current.click() | |
} | |
const preventBubbling = (e) => { | |
e.stopPropagation() |
This file contains hidden or 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 Upload = () => { | |
const [files, setFiles] = useState(null) | |
const inputRef = useRef() | |
const handleClick = () => { | |
inputRef.current.click() | |
} | |
const preventBubbling = (e) => { | |
e.stopPropagation() |
This file contains hidden or 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 Upload = () => { | |
const [files, setFiles] = useState(null) | |
const inputRef = useRef() | |
const handleClick = () => { | |
inputRef.current.click() | |
} | |
const preventBubbling = (e) => { | |
e.stopPropagation() |
This file contains hidden or 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 Upload = () => { | |
const inputRef = useRef() | |
const handleClick = () => { | |
inputRef.current.click() | |
} | |
const preventBubbling = (e) => { | |
e.stopPropagation() | |
e.preventDefault() |
This file contains hidden or 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 Upload = () => { | |
const inputRef = useRef() | |
const handleClick = () => { | |
inputRef.current.click() | |
} | |
return ( | |
<div className="Upload" css={CSS}> | |
<div className="inner"> |
This file contains hidden or 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 Upload = () => { | |
return ( | |
<div className="Upload" css={CSS}> | |
<div className="inner"> | |
<div className="list"> | |
<h5>Your Files:</h5> | |
<ul className="files">{/* file names here. */}</ul> | |
</div> |
This file contains hidden or 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
import { useState, useEffect } from 'react'; | |
export const useFileUpload = () => { | |
const [files, setFilesState] = useState([]) | |
const setFiles = e => { | |
let filesArr = [] | |
if (e.currentTarget?.files) { | |
filesArr = Array.from(e.currentTarget.files); |
This file contains hidden or 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
import { useState, useEffect } from 'react'; | |
export const useFileUpload = () => { | |
const [files, setFilesState] = useState([]) | |
const setFiles = files => { | |
setFilesState(Array.from(files)) | |
} | |
return { |
This file contains hidden or 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
import { useState, useEffect } from 'react'; | |
export const useFileUpload = () => { | |
const [files, setFiles] = useState([]) | |
return { | |
files, | |
setFiles | |
} | |
}; |
This file contains hidden or 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
import { useState, useEffect } from 'react'; | |
export const useFileUpload = () => { | |
// | |
}; |