I looked for similar issues but couldnt find a solution. I am able to generate the headings column and the rows with the values. but since they are done separately, the alignment is off. so, is there a way to make it better aligned or maybe nest it in a way that only trowz is enough?? without the iteration being done in tvalues separately?
here's the related code
let keysForSalaryMonth=Object.keys(this.props.stateprops.salarysheet[this.props.stateprops.salaryForMonth]);
let salaryProperties = Object.keys(this.props.stateprops.salarysheet[this.props.stateprops.salaryForMonth][keysForSalaryMonth[0]]);
let salaryObj = this.props.stateprops.salarysheet[this.props.stateprops.salaryForMonth];
console.log(salaryObj[keysForSalaryMonth[0]][name]);
const trowz = (<table><th>
{salaryProperties.map((item)=>
<td>{item}</td>
)}
</th>
</table>
);
const tvalues = (<table>
{ keysForSalaryMonth.map((epf)=>{
return (<tr>
{salaryProperties.map((prprty)=>
<td>{salaryObj[epf][prprty]} </td>
)}
</tr>)
}
)}
</table>);
return(
<div>
{trowz}
{tvalues}
</div>
)
}
the intended html is somewhat like this
<table>
<th><td>name</td><td>amount</td>wages</td></th>
<tr><td>Jack</td><td>34543</td>39999</td>
</table>
and it is coming like that too. the problem is that the column names are not aligned with the column values as they are not the same length. so, how do I get them to be aligned properly?
at the moment, it looks like this

I do have an idea now of why this was happening. I think it could be because both trowz and tavalues are in different tables. Now, I am trying to put them in the same table but it's not working
here's the revised format of how it looks now, when I try to put it in the same table. Please tell me where I am going wrong.
const trowz = (<th>
{salaryProperties.map((item)=>
<td>{item}</td>
)}
</th>
);
const tvalues =( keysForSalaryMonth.map((epf)=>{
return salaryProperties.map((prprty)=>
<tr> <td>{salaryObj[epf][prprty]} </td> </tr>
)})
);
return(
<table>
{trowz}
{tvalues}
</table>
)
}
@A Iglesias, your solution makes it look like this
which is similar to what i was getting with the edited code above.
the generated html
<table>
<th>
<td>name</td><td>epf</td><td>hra</td><td>days</td><td>wagesrate</td><td>basicSalary</td><td>totalWages</td><td>totalAmountPayable</td><td>da</td><td>totalAmount</td><td>pfValue</td><td>esiValue</td><td>totalDeduction</td>
</th>
<tbody>
<tr><td>pintu</td><td>98798789</td><td>902</td><td>2</td><td>8789</td><td>987987</td><td>17578</td><td>18033</td><td>454.6</td><td>18935</td><td>2164</td><td>331</td><td>2495</td></tr>
</tbody>
</table>
HTMLoutput?