Skip to content

Instantly share code, notes, and snippets.

@JoviDeCroock
Created February 10, 2021 15:51
Show Gist options
  • Save JoviDeCroock/bd0a8fb7bce214a6022717ad1a43eceb to your computer and use it in GitHub Desktop.
Save JoviDeCroock/bd0a8fb7bce214a6022717ad1a43eceb to your computer and use it in GitHub Desktop.

The thing I miss in my current project for instance would be the fact that it's hard to be granular in queries, let's say we have a root that queries a set of products.

useQuery({ query: 'query { products { } }'})

We'd have to tailor the selectionSet of products for all the sub-components here. If we know we have a ProductList child, I'd love to make it look like this:

export const ProductList = function(){ return jsx }
ProductList.dataRequirements = ['fragment productListFields on Product { id title image}'];

This in turn could then make the root component a bit smarter and enrich the queried data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment