i am looking to make something like this:
Let's say that i have two arrays:
names: ["Prisma 2 Case", "PP-Bizon", ...]
imgs: ["img1.png", "img2.png", ...]
one with names and one with picture of the item. What i want to make is a table that has an image and the name in one cell.
I hav etried something like this:
<table className="table">
<tbody>
<tr>
{this.state.names.map((data, i) => {
return <th key={i}>{data}</th>;
})}
</tr>
<tr>
{this.state.imgs.map((data, i) => {
return (
<td key={i}>
<img className="style" src={data} alt="" />
</td>
);
})}
</tr>
</tbody>
</table>;
But what it did are two seperate rows. It has to by some loop because the number of owned items isnt always the same.
Thanks for your answers.
[{name: "Prisma 2 Case" image: "img1.png"}, {name: "PP-Bizon" image: "img2.png"}, ...]iindex to render imeges while mapping names ...names.map(name,i){ {render name} ... {render img using imgs[i] } }