So i’m having issue with creating a File and storing it in my react state, when i create the new File, i can see it has been created, but then when i try to update the state variable it is empty, maybe i am missing something here ?
const [picture, setPicture] = useState<File>(new File([""],""))
function submitPhoto(blob) {
let newFile = new File([blob], "file.tmp.png", {type: `image/png`})
setPicture(newFile)
console.log(newFile)
console.log(picture)
}
Console output gives me
File { name: “file.tmp.png”, lastModified: 1714879232978, webkitRelativePath: “”, size: 225845, type: “image/png” }
File { name: “”, lastModified: 1714879226495, webkitRelativePath: “”, size: 0, type: “” }