In the code below, we’re using a simple React component taking as props an array of object containing names & jobs, building the various row of the table and eventually returning the table body.
const TableBody = (props) => {
const rows = props.characterData.map((row, index) => {
return (
<tr key={index}>
<td>{row.name}</td>
<td>{row.job}</td>
</tr>
)
})
return <tbody>{rows}</tbody>
}
Where I’m confused is the last line where in JSX we’re using an array. How come <tbody>{rows}</tbody>
is parsed when rows is an array?
I understand my question might be a bit confused, but if you have some resources to help out or explanations, that’d be dope!!!
Many thanks in advance and happy coding