I have an object like so:
{
"id": 1,
"name": "car",
"colors": ["white", "black"]
}
I put my object into data using useState.
When i try data.name the result is "car"
When i try data.colors the result is "whiteblack"
But when i try mapping over the colors using:
{data.colors.map((color, i) =>
<span key={i} >{color}</span>
)}
Ill get TypeError: Cannot read property 'map' of undefined
What am I missing?