• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

117
Views
Value is not properly showing in table body in react js

Need output like this. The headers are dynamic and body is not rendering properly. please help me to fix it.

here my code:

{
data?.show &&
<th className="text-center" key={index}>
<td colSpan={data?.st && data.st.length} style={{ border: "none" }}>
    {data.label}
</td>
<tr className="p-0">
    {
    data?.st?.map(sub => {
    return (
    <td style={{ borderColor: "black" , fontWeight: "400" }}>
        {sub}
    </td>
    )
    })
    }
</tr>
</th>
}

<tbody>
    {
    res.datas && res.datas.map((ele, index) => {
    var eles = Object.values(ele);
    return (
    <>
        <tr key={index}>
            <td align="center">{1 + index}</td>
            {
            eles.map(dt => {
            return (
            <td align={typeof (dt)==="string" ? "left" : "center" }>
                {dt}
            </td>
            )
            }
            )
            }
        </tr>

    </>
    )
    })
    }
</tbody>

But I got output like this.this The expected output is added in the top.

about 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error