import FileSaver from "file-saver"; import { useEffect } from "react"; import "./ImageOutput.css"; interface OutputProps { imageData: Blob; } function ImageOutput({ imageData }: OutputProps) { const imageUrl = URL.createObjectURL(imageData); useEffect(() => { return () => { URL.revokeObjectURL(imageUrl); }; }, [imageUrl]); const handleClick = () => { const extension = imageData.type.split("/")[1]; FileSaver.saveAs(imageData, `image.${extension}`); }; return (
); } export default ImageOutput;