i have one table structure in my react app using jsx, here is my code…
<div>
<TableWrapper className="table-data-view table-responsive">
<ChartViewWrapper>
<table align="center" className="record">
<thead>
{!charts[0] || charts[0].freq === 6 ? (
<tr key="1">
<td>Date</td>
<td colSpan="3">MON</td>
<td colSpan="3">TUE</td>
<td colSpan="3">WED</td>
<td colSpan="3">THU</td>
<td colSpan="3">FRI</td>
<td colSpan="3">SAT</td>
</tr>
) : (
''
)}
{!charts[0] || charts[0].freq === 7 ? (
<tr key="2">
<td>Date</td>
<td colSpan="3">MON</td>
<td colSpan="3">TUE</td>
<td colSpan="3">WED</td>
<td colSpan="3">THU</td>
<td colSpan="3">FRI</td>
<td colSpan="3">SAT</td>
<td colSpan="3">SUN</td>
</tr>
) : (
''
)}
{!charts[0] || charts[0].freq === 5 ? (
<tr key="3">
<td>Date</td>
<td colSpan="3">MON</td>
<td colSpan="3">TUE</td>
<td colSpan="3">WED</td>
<td colSpan="3">THU</td>
<td colSpan="3">FRI</td>
</tr>
) : (
''
)}
</thead>
<tr>
<td>
29/12/14
<br /> to
<br /> 01/01/15
</td>
{charts.map((chart, index) => {
return (
<>
<td className="verticaltext">{chart.open}</td>
<th>{chart.jodi}</th>
<td className="verticaltext">{chart.close}</td>
{ {(index + 1) % charts[0].freq === 0 ? </tr><tr> : ''} }
</>
);
})}
</tr>
</table>
</ChartViewWrapper>
</TableWrapper>
</div>
here the task is that we have to add 34 from the starting second row below 06 under Monday column….as i tried the code mentioned in my code it shows error: JSX expressions must have one parent element.
I don’t know how to resolve such error in my case…..here we cannot use default table structure of react like dataSource and columns…can anyone help me to get rid out of this….
2
Answers
After searching from google i finally get solution of my own problem...that i want to share here...
Main Data:
Now i split main data into interval and push on another array like this...
and finally return output as JSX like below:
anyway thanks everyone....
I’m not sure if this is the source of your error but you’ve inverted a closed and opened jsx tag:
should be: