Untitled
const [file, setFile] = useState<File | string>(); const [previewImage, setPreviewImage] = useState<string>(); function handleChangeImage(e: React.ChangeEvent<HTMLInputElement>) { // console.log(e.target.files); if (!e.target.files) return; setFile(e.target.files[0]); setPreviewImage(URL.createObjectURL(e.target.files[0] || null)); dispatch(updateImagePreview({ data: { imagePreview: e.target.files[0] } })); }