I have a data like below
export const DataShirts = [
{
type:"tshirt",
brand:"Levis"
},
{
type:"tshirt",
brand:"Duke"
}
]
I am trying to send props in Home.js
{ data && data.length > 0 ? data?.map((item,index) => {
return <Grid key={index} item xs={6} md={3}> <ProductCard item={item} /> </Grid>}) : null}
in ProductCard.js component file
const ProductCard = ({item}) => {
console.log(item.brand) // it's return undefined at second render
return (
<>
</>
)
}
what is the mistake here.
After Update the code
At first time, the output is correct, but second time it is showing undefined.
Why it render second time?