In GraphQL, it is possible to create a straightforward query to fetch only the data you want. By doing this, your code can reduce the usage of your user network and processing power. This technique is also known as fragments.
In this recipe, we will learn how to create GraphQL fragments and use them in our application.
Getting ready
The prerequisites for this recipe are as follows:
- The project from the Creating User pages and routes for your application recipe in Chapter 5, Creating the User Vuex Module, Pages, and Routes
- Node.js 12+
The Node.js global objects that are required are as follows:
- @aws-amplify/cli
- @quasar/cli
To start our GraphQL fragments that will be used on the application, we will continue with the project that we created in Chapter 5, Creating the User Vuex Module, Pages, and Routes.
How to do it...
In this recipe, we will create the fragments needed in our application, and replace some of the code that we wrote in the last...