Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

286
Views
cannot add property x, object is not extensible

I am trying to write a function that adds an object to an formik FieldArray. I am not using preventExtensions func and I also tried making a copy of the object from a different solution I found but nothing has worked in resolving this error. Does anyone know how to add this object and avoid this error?

const handleDropDownValueCheck = (e: any) => {
    const propertyFileIndex: number = e.target.value;
    const propertyInformation: object = {
      address: PropertyFiles[propertyFileIndex]?.address as string,
      property_file_id: PropertyFiles[propertyFileIndex]
        ?.property_file_id as string,
      property_file_name: PropertyFiles[propertyFileIndex]
        ?.property_file_name as string,
      property_id: propertyListItem?.id,
    };

    selectedProperties?.find((propertyMapping, i) => {
      if (propertyMapping.property_id === propertyListItem?.id) {
        selectedProperties[i] = propertyInformation;
      }
    });

    const propertyInformationCopy = Object.assign([], propertyInformation);

    selectedProperties?.push(propertyInformationCopy);

    arrayHelpers.push(selectedProperties);
  };
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!