You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run the following command to install dependencies from the previous sample:
16
16
17
17
```bash
18
18
npm install
19
19
```
20
20
21
21
# Libraries
22
22
23
-
- We are going to install a library to work with graphql in front side, [graphql-request](https://github.com/prisma-labs/graphql-request). Make sure you are over `root` folder in terminal
23
+
Typically, we can use libraries like [graffle](https://github.com/graffle-js/graffle) or [Apollo Client](https://www.npmjs.com/package/@apollo/client) to interact with a GraphQL API. For example:
24
24
25
25
```bash
26
-
npm install graphql-request graphql --save
26
+
npm install graffle@next graphql --save
27
27
```
28
28
29
-
> It has `graphql` lib as peerDependency.
30
-
> Install this library on frontend package.json
29
+
However, in this case, we will not use any external libraries and will handle GraphQL requests manually using the native fetch API.
The `graphql function` allows sending queries and retrieving data from the GraphQL server. It is responsible for:
122
+
123
+
- Sending the query to the server.
124
+
- Passing the required parameters or variables.
125
+
- Receiving the server response.
126
+
- Handling possible errors.
127
+
128
+
Currently, errors are simply logged to the console. However, in the future, we could implement a more robust error-handling mechanism, such as throwing exceptions, displaying user-friendly error messages, or integrating with an error-tracking system.
0 commit comments