I saw this code in a tutorial:
tours.map(tour => {
return <Tour key={tour.id} {...tour}/>;
})
Tours is just an array of objects. I'm beginner to react, and as I understand, "tour" object is passed down as a prop to the component. However, I don't understand why do you have to individually pass all key-property values with the spread operator, why can't you just pass down the whole object?
Also why there is no need to define a name? Like: <Tour greet = {'hello'} />