relayjs - What do 3 dots/periods/ellipsis in a relay/graphql query mean? -


the relay docs contain fragment:

query rebelsrefetchquery {   node(id: "rmfjdglvbjox") {     id     ... on faction {       name     }   } } 

what ... on faction on syntax mean?

there 2 uses of ... related fragments.

incorporating fragment reference

query foo {   user(id: 4) {     ...userfields   } }  fragment userfields on user {   name } 

has effect of composing fields fragment embedding query:

query foo {   user(id: 4) {     name   } } 

note fragments may compose other fragments.

inline fragments

these can used compose fields in type-dependent way. example:

query foo {   profile(id: $id) {     url     ... on user {       homeaddress     }     ... on business {       address     }   } } 

in example, server determine whether return homeaddress or address field @ runtime, based on whether requested object user or business.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -