score:3

Accepted answer
React.createElement("form", null);

score:2

import React, {Component} from 'react';
class Table extends Component {

  constructor(props)
    this.powerLevels = 
    [
      {level: "1", comment: "Weakling!"} , 
      {level: "9001", comment: "It's over 9000!"}
    ];
  } 


  //Adds columns in between the rows
  addColumns = (index) => {
    return (
      <td> {this.powerLevels[index].level} </td>
      <td> {this.powerLevels[index].comment} </td>
    }
  }
  //Adds a table row
  addRow = (index) => {
    return (
      <tr>
        {this.addColumns(index)};
      </tr>);
  }

  generateTable = () => {
    let tableLength = this.powerLevels.length;
    let jsxArray = [];

    for(let i = 0; i < tableLength; i++){
      jsxArray.push(this.addRow(i));
    }

    return  (<tbody> {jsxArray} </tbody> );
  }

  render () {

    //{} these brackets allow for Javascript to be written
    return (
      <div>

        {this.generateTable()}

      </div>
    );
  }
}

Related Query

More Query from same tag