I'm developing a simple ecommerce store. Product information is stored in DynamoDB (NoSQL). Items in Product table has an "image" attribute with a single URL, and also an "images" attribute which store multiple strings. I just added the "items" attribute to test if I can store multiple URLs (which point to images in S3 bucket)
In my function component, I get the data from Graphql API and set the state correctly. In my template I use {image}
to render it. However if I try to use {images[0]}
or {images[1]}
, the page is not rendered and I got the following error: "images is undefined".
In React Developers Tools I can see the "images" variable correctly displaying 3 urls. The query to the API also works correctly.
Why does my app works correctly when using {image}
but not when using {images[0]}
?