import { gql, useQuery } from '@apollo/client'
const GET_CART_QUERY = gql`
query cart {
id
products {
id
quantity
brandName
itemName
}
}
`
// Invoking query inside the React Component
const { loading, data, error } = useQuery(GET_CART_QUERY)
[
{
id: 1,
quantity: 10,
brandName: 'Glossier',
itemName: 'Lipstick',
price: {
total: 19.99
},
outOfStock: false,
availableStock: 3010
},
{
...
}
]