Javascript – TypeError: "name" is read-only ,when trying to update the value
I use this handleDepartmentChange to change the input value when updating. const handleDepartmentChange = (companyIndex, departmentIndex, e) => { const newCompanies = [...companies]; newCompanies[companyIndex].children[departmentIndex].name = e.target.value; console.log(newCompanies[companyIndex].children[departmentIndex].name); setCompanies(newCompanies); }; For that I use the following way <div style={{ display: "flex"…