I am trying to render my dynamic JSON , but I am getting a table per result when it should be rendered in the same table.. what’s happening this? my dummy array is a model from my backend api
const arr = [
{
"Demo": [
{
"_id": "T08210",
"name": "tilehaha",
"tags": [
"Demo"
],
"queries": [],
"urls": [],
"max_leght": [],
"count_items": []
},
],
}
];
export default function Demo() {
return (
<div>
{arr.map(obj =>
Object.entries(obj).map(([key, value]) => (
<table class="table">
<thead>
<tr key={key}>
<th scope="col">{key}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{value.activityType}</td>
<td>{value.durationInSeconds}</td>
</tr>
</tbody>
</table>
)))}
</div>
);
}
I need to place in the blue section as heading 2671161009, and 2671161249
, and their child items as the following
Based on your comments, it seems like maybe this is what you want:
Note that at the top of that code sample, I transformed your input into a more usable format. Your beginning
arr
, for example, was an array of just 1 object, which had multiple keys, which really seemed to be the array you wanted to iterate over.Hopefully this is at least close to what you’re looking for.
Try this.
The issue is here:
here you have put the entire table inside the loop instead of putting a single table row. So on every iteration it generates a new table. To resolve this issue, try this:
Try this:
buy nothing day essay – http://boessay.com/ professional letter writing services
Cgthcv – furosempi.com Tlivdw zaqnjn
Wiuoys – viagra tablet online india Kfsrsr brljnt
Kbqirj – essay dissertation Tsrrpq gqlbxn
Taevcq – sildenafil 50 mg buy online price Oaynof zqyxqu
Dickve – viagra poppers Xfenew ogoxqr
Kevacx – finasteride for hair order online Sttrep fwmixt