Can anyone explain me why my graphQL query always uses default values even if I specified my own value for this argument?
const FEED_QUERY2 = gql`
query FEED_QUERY2($category : String = "NoPosts")
{
feed2(filter: $category ) {
blogposts {
id
name
categories {
id
name
}
}
}
}
`
And am calling my query like this
import { Query } from 'react-apollo'
.
.
.
const category_string = "Python";
<Query query={FEED_QUERY2} category={category_string}>
category
is not a valid prop for the Query
component. The props available on the component are shown here in the docs. If you want to pass variables to your query, you should use the variables
prop.
<Query query={FEED_QUERY2} variables={{category: category_string}}>