import React, { FormEventHandler } from "react"; interface Props { onImageSubmit: (image: Blob) => void; } function ImageInput({ onImageSubmit }: Props) { const fileInputRef = React.useRef(null); const handleSubmit: FormEventHandler = (e) => { e.preventDefault(); if ( !fileInputRef.current || !fileInputRef.current.files || fileInputRef.current.files.length === 0 ) { return; } onImageSubmit(fileInputRef.current.files[0]); }; return (
{/* */}
); } export default ImageInput;