From the course: React: State Management (2019)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Apollo Link State: Integrating state management with GraphQL

Apollo Link State: Integrating state management with GraphQL - React.js Tutorial

From the course: React: State Management (2019)

Start my 1-month free trial

Apollo Link State: Integrating state management with GraphQL

- [Narrator] A great alternative to Redux or React State Management if your code base is using GraphQL is to use Apollo Client. The nice thing about using GraphQL is that when you're making a call to the server to get your data, you can call it in exactly the shape you'd like to receive it. As an example, let's take a look at the Google Books API. If we call the API directly, we can see here that we get a ton of information. We don't need all of this information, nor do we need it in exactly this shape. Let's take a look now at an Apollo GraphQL example response. You can see here that we can get exactly the items that we need in exactly the shape that we'd like it. If you think about it, a lot of what state management does is call various endpoints to get data and then manipulate that data to fit a certain shape to provide to React components. Other things like color changes on hovering, modals opening and closing, are all well-suited for React state. What does this mean? If we're…

Contents