Every time I input {alert(JSON.stringify(cart[0]))}
in my react-native application, the result displayed is the complete array of objects as shown below:
[{
"id": 3,
"name": John,
.
.
}]
However, when I try
{alert(JSON.stringify(cart[0].id))}
, the output always shows undefined
.