I'm getting the value of a File Object when using <inpu type="file" /> but when accessing e.target.files[0] I can't use it with spread operator or Object.assign.
I want to save the state with all of the File's properties and add some more data to it, but it doesn't work, it gives me a empty object.
Here is an codesandbox to reproduce it.
const onChange = e => {
const file = e.target.files[0];
console.log(file); // Logs File Object
console.log({ ...file }); // Logs empty Object
console.log(Object.assign({}, file)); // Logs empty Object
setFile({ ...file, extraData: "hey" }); // Sets Object only with `extraData`
}
Why it doesn't spread the File properties?