I have the following array:
const cuisines = [
{ african: "African" },
{ american: "American" },
{ arabian: "Arabian" },
{ argentine: "Argentine" },
{ asian: "Asian" },
{ asian_fusion: "Asian Fusion" },
{ australian: "Australian" },
{ austrian: "Austrian" },
{ bbq: "BBQ" },
{ bakery: "Bakery" }
]
and I have the following React JSX code to loop through each object in the array:
<select name="cuisines" id="cuisines" size={10} multiple className="form-control" onChange={e => handleMultiple('cuisines', e)}>
{cuisines.map((cuisine, index) => {
for (let [key, value] of Object.entries(cuisine)) {
return <option key={index} value={key}>{value}</option>
}
})}
</select>
I'm getting the results and working fine but my IDE is informing me the following message:
'for' statement doesn't loop why I see this message?
Also I'm wondering if using for...of to loop through the object entries and return JSX code is the best approach in my example case or if there are any other approach that I can follow which is better.
