I try to change render when there is a change with useEffect
and I have this error "Cannot read properties of undefined (reading 'forEach')". when I log the console print the array and its values.
const listMemo = useMemo(() => ({ list }), [list]);
useEffect(() => {
console.log(list) //Print the array
console.log(listMemo) //Print the array
listMemo.list.array.forEach((element, i) => {
//********************************
//*************************************** */
}
});
}, [listMemo]);
listMemo.list.forEach(
NOT
listMemo.list.array.forEach(
- removearray
and one of dots.