Here is the code
const [somethingChange, setSomethingChange] = useState<Record<string, File>>({
signature: {} as File,
document1: {} as File,
});
const valueChange = (e: File, target: string) => {
setSomethingChange({ ...somethingChange, target: e });
};
What I want to do is on valueChange
function I am using like this
const file = new File([], 'signature.jpg', { type: 'image/jpeg' });
valueChange(file, 'signature');
But the function always create a new object key value
pair.
{
signature: {},
document1: {},
target: File
}
How Can I modify this one