I'm new to GraphQL, I can't figure out why when I request to get data, for example data.category.products, I get the correct output, but for example, if I request data.category.products.prices, I will get this error: TypeError: data. category.products.prices is undefined
My Query:
query AllCategory{
category {
products {
id
prices {
currency {
label
}
amount
}
}
}
}
Doesn't give errors in Playground
And actually how I call: (this is with an error)
export default function App() {
const {data} = useQuery(QUERIES)
return (
<div className="App">
{data.category.products.prices.map((shop) => (
<p key={shop.currency.label}>{shop.amount}</p>
))}
</div>
);
}
There is no error here:
{data.category.products.map((shop) => (
<p key={shop.id}>{shop.id}</p>
))}
I`m using apollo client
