Using an unspread fragment in GraphQL

19 views Asked by At

What are the dangers of calling useFragment on a fragment that has not been spread in any query? If I have a fragment that is like

fragment myfragment_Object on Object {
   ... do stuff
}

can I call useFragment(myfragment_Object, objectRef) even if the fragment is not spread on the query where the object is retrieved?

1

There are 1 answers

1
Sanj On

I don't think that would work because a fragment is just asking for characteristics of your object. If you don't connect the fragment to a larger query then your objectRef wouldn't be referencing something tangible