Sorry if the titel was a bit of or bad.
But the thing is that im fetching from my db and im using map to display each product and i have a selectionbox inside the rendered product where im trying to map from an array in the db.
Im fetching like this:
fetch('/api/products')
.then(res => res.json())
.then(allProducts => {
this.setState({ allProducts });
});
My map look like this:
{
this.state.allProducts.map(allProducts =>
<div className="products" key={allProducts.produkt_id}>
<select name="format">
<option value="choose_format">choose format</option>
</select>
</div>
)
}
And in my db the array is stored like this in a column:
[{"car":"audi"},{"car":"bmw"}]
How do i map out the different cars as options or im i doing something wrong and can i store it in a better way?