Reputation: 37
.
I want to get the[items] Array object
separately.
My doubt is that the <value> object
generated from the function return and due to <value> object
it is not indexing properly.
I tried these approaches:
views.value.items
not working.views[0][items]
not working.Upvotes: 0
Views: 101
Reputation: 561
views
seems to be a Promise, that wraps the actual value you want. So you need to call the .then()
method on it and provide a callback that can use the value that is inside the Promise. Or if you are in an async
function, use await
.
I would recommend to read at least the two following pages, that describe how to use promises in the two mentioned ways:
Upvotes: 1
Reputation: 458
As I understand views and value is an object. If so, you can use views.value.items[0]
It is better to check value type with console.log(typeof views)
Upvotes: 0