Object is not extensible error when creating new attribute for array of objects

You probably need to copy the objects:

export const initSelect = (data) => {
 return data.map((item) => ({
     ...item,
     selected: false       
 }));
}

Leave a Comment