How it works...

In this recipe, we use a GraphQL BFF that is similar to the one we created in the Implementing a GraphQL CRUD BFF recipe. The focus here is on the frontend application, which we create with ReactJS and the Apollo Client, and specifically on how to cache our interactions with the service. First, we create the ApolloClient in the src/index.js file and initialize it with the endpoint for the service and, most importantly, the InMemoryCache object.

Next, we implement the user interface in the src/App.js file. The screen displays a list of things that are returned from the things query. The Apollo Client will automatically cache the results of the query. The mutation that updates the individual objects will automatically update ...

Get JavaScript Cloud Native Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.