import { RefObject, useRef, useState } from "react"; import { UploadButton } from "./UploadButton"; export const FileInput = () => { const inputRef = useRef() as RefObject; const [file, setFile] = useState(null); const onFileChange = async () => { if (!inputRef?.current?.files) { return; } const file = inputRef.current.files[0]; setFile(file); }; const reset = () => { if (!inputRef?.current) { return; } inputRef.current.value = ""; setFile(null); }; const onClick = () => { if (!inputRef?.current) { return; } inputRef.current.click(); }; return ( <> ); };