The two examples below are apparently resulting in the exact same code.
Example 1 (React child):
const Child = ({ item: { startedAt, count } }) => (
<div>
<div>{startedAt}</div>
<div>{count}</div>
</div>
)
const Parent = items => {
return (
<div>
{items.map((item, index) => (
<Child key={item.id} item={item} />
))}
</div>
)
}
export default Parent
Example 2 (function child):
const child = ({ id, startedAt, count }) => (
<div key={id}>
<div>{startedAt}</div>
<div>{count}</div>
</div>
)
const Parent = items => {
return <div>{items.map(child)}</div>
}
export default Parent
Why would one go with example 1, i.e. a React component? Are there any benefits over the function example?