const Fila = ({ tam, inicio }) => (
<tr>
{Array.from({ length: tam }).map((x, i) => (
<td key={Math.random()}>{inicio + i + 1}</td>
))}
</tr>
)
const Tabla = ({ ancho, alto }) => (
<table>
<tbody>
{Array.from({ length: alto }).map((x, i) => (
<Fila key={i} tam={ancho} inicio={i * ancho} />
))}
</tbody>
</table>
)
export default Tabla
const Fila = ({ tam, inicio }) => {
const res = []
for (let i = 0; i < tam; i++) {
res.push(<td key={i}>{inicio + i + 1}</td>)
}
return res
}
const Tabla = ({ ancho, alto }) => {
const foo = []
for (let i = 0; i < alto; i++) {
foo.push(
<tr key={i}>
<Fila tam={ancho} inicio={i * ancho} />
</tr>
)
}
return (
<table>
<tbody>{foo}</tbody>
</table>
)
}
export default Tabla
const Tabla = ({ ancho, alto }) => (
<table>
<tbody>
{Array.from({ length: alto }).map((x, i) => (
<tr key={i}>
{Array.from({ length: ancho }).map((x, j) => (
<td key={Math.random()}>{ancho * i + j + 1}</td>
))}
</tr>
))}
</tbody>
</table>
)
export default Tabla