79465263

Date: 2025-02-25 02:31:50
Score: 2
Natty:
Report link

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?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: ashish singh Negi