I am trying to loop the API data into a table as in the image, but I am getting an error.
I want date-wise data main module name must come as table headers, and corresponding sub-modules will come under the main module as in the image.
Note: the main module will have more than one sub-module as in the image.
The last table header will be custom. It will have all the custom module names displayed date-wise.
<div style={{ display: "flex" }}>
{predefined.map((personData, index) => { ///mapping mainmodules
return (
<thead>
<tr>
<th style={styles.th}>{personData.mainModule}</th>
</tr>
{personData.submodule
.filter((e) => e.completed == true) ///maping submodules
.map((subModule) => {
return (
<>
<tr>
<td style={styles.td}>{subModule.subModuleName}</td>
</tr>
</>
);
})}
</thead>
);
})}
<thead>
<tr>
<th style={styles.th}>custum</th>
</tr>
{custom.map((personData, index) => {
return (
<tr>
<td style={styles.td}>{personData.name}</td>{" "}
</tr>
);
})}
</thead>
I have created a code sandbox of complete code I tried.
https://codesandbox.io/s/blissful-http-fdl0f?file=/src/App.js
