If same code is used in three distinct locations, hoist it
Example 1: When you are using a vendor "nice messenger" to power your chat system, don't expose that nice messenger
is powering your chat system by including it in names
instant messenger
or social
to make it generic so any vendor or system can substitute nice messenger
when the underlying implementation needs to changeExample 2: exposing __typename
GQL metadata field onto the schema as a data type shape
__typename
__typename
is a reserved field in GraphQL that returns the name of the object type for a particular GraphQL object
Every object type in your schema automatically has a field named __typename
(you don't need to define it)
__typename
is useful is for instance for Apollo client since it uses it for client side cache entries and polymorphism. But should not be used for anything else