i am working on the same ,what i am looking is do we need to parse the formdata when retrieving it
const submitForm = (event: React.FormEvent) => {
event?.preventDefault();
//without parsing showing me [Spread types may only be created from object
types.ts(2698)
]
const prevFormData = JSON.parse(localStorage.getItem("templateFormData"));
// but after parsing it showing this erro [Argument of type 'string | null' is not assignable to parameter of type 'string'.
Type 'null' is not assignable to type 'string'.ts(2345)]
const updatedFormData = {
...prevFormData,
headerColor,
primaryColor,
textColor,
logo,
fileName,
};
};
how to use the formData again?