I'm currently on client side trying to make a query but can't go through. However it works when testing at the back-end.
const QUERY_SPECIFIC_CATEGORY_PRODUCTS = gql` query QUERY_SPECIFIC_CATEGORY_PRODUCTS($category: String!) { category(input: { title: $category }) { name } } `; const { data, loading, error } = useQuery(QUERY_SPECIFIC_CATEGORY_PRODUCTS, { // prettier-ignore variables: {input: { title: "clothes" }} });
When you call useQuery
just pass the "clothes" value as the category
variable:
const { data, loading, error } = useQuery(QUERY_SPECIFIC_CATEGORY_PRODUCTS, {
variables: { category: "clothes" },
});