'React SPFX component Error: Minified React error #31

I have used dataList to store and display data into table. Below is the initialization for the same.

const [dataList, setDataList] = useState([]);

While I am trying to update item in dataList and assign new updatedDataList array to it I am getting below error

Error: Minified React error #31; and thus my U.I. is not re-render

Below is my update function call.

const updateDataObj = (item) => {         
  let updatedDataList = dataList.map((ele) => {
    console.log("ele...", ele);
    if (ele.ID === item.ID) {
      const newDataList = {
        ...ele,
        ...item,
      };         
      return newDataList;
    }
    return { ...ele }
  });     
setDataList(updatedDataList);
}).catch((err) => {
  console.log("err...", err)
 });
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source