1

I am building a react native app which has a map function to create markers on a map for an array of different places. To do this I am using an API to get the coordinates and so need to use an async function as so:

this.state.place.map(async (place) => {
  const coords = await fetchCoords(place)

  return (
    <Marker coordinate={coords}/>
  )
})

But this code gives the error Invariant Violation: Objects are not valid as a React child (found: object withkeys {_40, _65, _55, _72}). I am guessing the error is because I have implemented the async map function wrong. What should it be?

M. Alex
  • 673
  • 5
  • 26

0 Answers0