I am creating a react website where I am using firebase cloud firestore. This is the code which I am currently using(according to the docs):
async function onTypeSelected(type = "Electronics") {
  var querySnapshot = await getDocs(collection(db, type))
  console.log(querySnapshot)
  querySnapshot.forEach(doc => {
    console.log(doc.data())
  })
}
This code is working perfectly. I am able to see the output in the console:
However if I use .map() method I am getting an error:
async function onTypeSelected(type = "Electronics") {
  var querySnapshot = await getDocs(collection(db, type))
  console.log(querySnapshot)
  var a = querySnapshot.map(
    (doc) => {
      return <Card data={doc.data()} />
    }
  )
  console.log(a)
}
<Card /> is another component which I created by myself:
function Card(props) {
  return (
    <div className='main__container__card'>
      <img src={props.image} />
      <div style={{ marginTop: 20 }} />
      <hr />
      <div style={{ marginTop: 10 }} />
      <h2>{props.price}</h2>
      <div style={{ marginTop: 10 }} />
      <hr />
      <div style={{ marginTop: 10 }} />
      <div className='main__container__card__btn'>
        <CurrentQuantity />
      </div>
    </div>
  )
}
Error:
What is the error here?
Please comment if more information is needed.


 
    