Unions are used when we want a GraphQL field or list to handle multiple types of data. With a Union Type, we can define a field that could resolve completely different types of data. In this lesson, we will write a query that obtains a list of different pet types
Unit type, we cannot use common field in query, I have to write in fragment:
# Write your query or mutation here
query {
familyPets {
__typename,
... on Cat {
name
},
... on Dog {
name
}
}
}