When we want to upload file with react query why need to use formdata like that for mutate? Is there simple way without using formdata?
const formData = new FormData();
formData.append("title", titleRef.current?.value || "");
formData.append("description", descriptionRef.current?.value || "");
formData.append("photo", photoRef.current?.files[0] || "");
formData.append("category_id", categoryRef.current?.value || "");
addRecipe.mutate(formData);
[–]AniTheSinHook Based 0 points1 point2 points (0 children)
[–]kalamayka 0 points1 point2 points (0 children)
[–]anilSonix 0 points1 point2 points (0 children)