Chapter 30: Why GraphQL?
In the preceding chapter, you learned about the architectural principles of state management in React. In particular, you used Context to implement more complex state management in a React application. Context, in combination with reducer functions, will help you to understand how state changes and flows in your application are a good thing. At the end of the preceding chapter, you also learned about the potential limitations in terms of scale.
In this chapter, we are going to walk you through yet another approach to handling state in a React application. Similar to Context, GraphQL can be used with both web and mobile React applications. GraphQL is a query language for APIs and is implemented on the server side. To connect with GraphQL from a React application, we'll be using the library called Apollo Client.
Unlike Context, you don't have to write reducers and actions to deal with state management. Instead, GraphQL provides a more declarative...