Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

538
Visualizações
How to create table with dynamically rows and columns with number in React-JS

let arr=[]
for(let i=2;i<=10;i=i+2){
  arr[i]=[]
 for(let j=1;j<=20;j=j+2){
  arr[i][j]=i*j;
 }
 console.log(`\n`);
}
console.table(arr);
https://stackoverflow.com/questions/ask#

**This Code Correct in JavaScript, But No Idea in React-JS

enter code here

How This Table Image Create in React-JS**

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

This is a simple table example using map()

The map() method builds the table by looping through all items of the array and returning HTML with the index and string of each array item.

HTML returned by map()

<tr key={index}>
  <td>
    {index}
  </td>
  <td>
    {str}
  </td>
</tr> 

Try the following snippet

function App(){
  const myArray = ['item zero', 'item one', 'item two']
  
  return[
    <table key='table-key'>
      <thead>
        <tr>
          <th>index</th>
          <th>string</th>
        </tr>
      </thead>
      <tbody>
      {myArray.map((str, index) => {
        return[
          <tr key={index}>
            <td>
              {index}
            </td>
            <td>
              {str}
            </td>
          </tr> 
          ]
        })}
       </tbody> 
    </table>
  ]
}
ReactDOM.render(<App/>, document.getElementById("root"));
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<div id="root"/>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda