I am getting the content in an array and I can see the contents of the array on console.log.
However, the length is 0
and the contents cannot be retrieved with a map. Why is this?
const contents = [] as any[]
useEffect(() => {
for(const key of Object.keys(fruits)) {
contents[key as any] = {
...fruits[key as any],
...vegetables[key as any],
}
}
}, [fruits, vegetables, contents])
console.log('contents', contents)
console.log('contents length', contents.length)