Introduction to Union Types
Explore how to query and manage different user types using union types in GraphQL. Learn to conditionally render components based on returned data with Apollo Client in React.
We'll cover the following...
We'll cover the following...
So far, we have looked at two queries that return consistent data types. Both the books and booksWithTitle fields return an array of Book objects. But how do we make our client support cases where a GraphQL field could potentially return different types of objects for the same query? Union types help us solve this problem.
What is a union type?
In this lesson, we will look at ...