#Can you share what your product tsx

1 messages · Page 1 of 1 (latest)

random sparrow
#

Sure, here you go:

export default function Product() {
    const router = useRouter()
    const { urlSlug } = router.query

    const rawProduct = useQuery(QUERY_PRODUCTS, {
        variables: {
            locale: router.locale,
            urlSlug: urlSlug?.toString()
        },
        skip: !router.isReady
    })

    const product = rawProduct.data.products.attributes.data

    return (
        <div>
            {product.name}
        </div>
    )
}
#

To get back to my problem: rawProduct.data is undefined

magic heath
random sparrow
#

I'm still having the same Issue, I did some loading stuff too, to prevent the error is coming that way