In the previous section, we learned how to build the backend for a login system using Apollo Server to create our GraphQL queries and mutations. You are probably thinking, Great, I have the backend working, but how can I use this on the frontend? And you're right – I always like to explain things with full examples and not just show basic things, even if this will take longer to do, so let's get started!
You can find the code for the example in this section at https://github.com/PacktPublishing/React-17-Design-Patterns-and-Best-Practices-Third-Edition/tree/main/Chapter05/graphql/frontend.
Configuring Webpack 5
Instead of using a create-react-app project, we will configure a React project from scratch using Webpack 5 and Node.
The first thing we need to do is install all the packages we are going to use:
npm init --yes
npm install @apollo/client @contentpi/lib cookie-parser cors express express-session jsonwebtoken react...