import React, { useRef } from 'react'; type FileUploadProps = { handleFileChange: (event: React.ChangeEvent) => void; onClick?: () => void; className?: string; children: React.ReactNode; }; const FileUpload: React.FC = ({ handleFileChange, children, onClick, className = '', }) => { const fileInputRef = useRef(null); const handleButtonClick = () => { if (onClick) { onClick(); } // necessary to reset the input if (fileInputRef.current) { fileInputRef.current.value = ''; } fileInputRef.current?.click(); }; return (
{children}
); }; export default FileUpload;