Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

534
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!