I am working with React, Redux and JS with a tutorial which used this dummy object as part of the redux store.
const initState = {
posts:[
[
{id: '1', title: 'Fire', body: 'Squirtle Laid an Egg'},
{id: '2', title: 'Land', body: 'Charmander Laid an Eg'},
{id: '3', title: 'More Land', body: 'a Helix Fossil was Found'}
]
]
}
In the tutorial, the producer uses posts.map() to access the data. Is there a way to access this data without the map function? I tried
<p>{posts[0].id}</p>
but I get the following error:
Uncaught TypeError: Cannot read property '0' of undefined
What would be the proper notation to only get the first id value of this object?