Home > database >  Trying to work with the mapping function and it keeps gives me this error?
Trying to work with the mapping function and it keeps gives me this error?

Time:10-29

TypeError: Cannot read properties of undefined (reading 'map')

11: https://i.stack.imgur.com/jObmG.png

CodePudding user response:

One possibility is that the posts array is empty. We can help better if you show us the posts object

CodePudding user response:

Maybe posts is undefined at the first rendering because it comes from an async call.

export default function Post({ posts = []}) { ... }
  • Related