You can easily create a react component and pass props
into it.
For example in this case, you can create a new component like.
function Cadastros({ cadastro }) {
return (
<div>
return(
<tr id={cadastro.id}>
<td>{cadastro.id}</td>
<td contentEditable="true" suppressContentEditableWarning={true}>{cadastro.nome}</td>
<td contentEditable="true" suppressContentEditableWarning={true}>{cadastro.cpf}</td>
<td contentEditable="true" suppressContentEditableWarning={true}>{cadastro.rg}</td>
<td contentEditable="true" suppressContentEditableWarning={true}>{cadastro.data_nasc}</td>
<td contentEditable="true" suppressContentEditableWarning={true}>{cadastro.sexo}</td>
<td align="center"><Button onClick={() => removerCadastro(cadastro.id)} variant="danger">Excluir</Button></td>
</tr>)
</div>
)
}
And then replace
<tbody>
{Cadastros.map(renderCadastros)}
</tbody>
with
<tbody>
{
Cadastros.map((c,i) => <Cadastro cadastro={c} key={i} />) }
</tbody>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…