I want to send a File in my request using React Js, but I am unable to append file in object of FormData using typescript. Here's my React Js Code
const [imageFile, setImageFile] = React.useState();
const [productImageMutation, productImageMutationResult]=useAddProductImageMutation();
const handleUploadClick = (e: any) => {
var file = e.target.files[0];
setImageFile(file);
};
const handleOnSubmit = (values: Picture) => {
const formData = new FormData();
formData.append("formFile", imageFile); //It Gives Error there.
productImageMutation({ data: formData});
};
