Skip to content

Commit

Permalink
Merge pull request #3842 from EledenGreen/patch-12
Browse files Browse the repository at this point in the history
updated links in part8b.md
  • Loading branch information
mluukkai authored Oct 23, 2024
2 parents 2f06657 + 31a5a86 commit 0819e18
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/content/8/en/part8b.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ client.query({ query })
ReactDOM.createRoot(document.getElementById('root')).render(<App />)
```

The beginning of the code creates a new [client](https://www.apollographql.com/docs/react/get-started/#create-a-client) object, which is then used to send a query to the server:
The beginning of the code creates a new [client](https://www.apollographql.com/docs/react/get-started#step-3-initialize-apolloclient) object, which is then used to send a query to the server:

```js
client.query({ query })
Expand All @@ -78,7 +78,7 @@ The server's response is printed to the console:

![devtools shows allPersons array with 3 people](../../images/8/9a.png)

The application can communicate with a GraphQL server using the *client* object. The client can be made accessible for all components of the application by wrapping the <i>App</i> component with [ApolloProvider](https://www.apollographql.com/docs/react/get-started/#connect-your-client-to-react).
The application can communicate with a GraphQL server using the *client* object. The client can be made accessible for all components of the application by wrapping the <i>App</i> component with [ApolloProvider](https://www.apollographql.com/docs/react/get-started#step-4-connect-your-client-to-react).

```js
import ReactDOM from 'react-dom/client'
Expand Down Expand Up @@ -239,7 +239,7 @@ The *useQuery* hook is well-suited for situations where the query is done when t

One possibility for this kind of situations is the hook function [useLazyQuery](https://www.apollographql.com/docs/react/api/react/hooks/#uselazyquery) that would make it possible to define a query which is executed <i>when</i> the user wants to see the detailed information of a person.

However, in our case we can stick to *useQuery* and use the option [skip](https://www.apollographql.com/docs/react/data/queries/#skip), which makes it possible to do the query only if a set condition is true.
However, in our case we can stick to *useQuery* and use the option [skip](https://www.apollographql.com/docs/react/data/queries#skipoptional), which makes it possible to do the query only if a set condition is true.

The solution is as follows:

Expand Down

0 comments on commit 0819e18

Please sign in to comment.