Skip to content

Commit

Permalink
Merge pull request #6574 from apollographql/sb/ac3-tweak-tweaks
Browse files Browse the repository at this point in the history
Intro edits + apparent missing dependency on docs
  • Loading branch information
Stephen Barlow authored Jul 13, 2020
2 parents 8e41343 + e53afd9 commit 870821d
Show file tree
Hide file tree
Showing 9 changed files with 189 additions and 317 deletions.
2 changes: 1 addition & 1 deletion docs/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
},
checkLinksOptions: {
exceptions: [
'/api/apollo-client/',
'/api/core/ApolloClient/',
'/v2.6/api/apollo-client/',
'/v2.5/api/apollo-client/',
'/v2.4/api/apollo-client/',
Expand Down
119 changes: 117 additions & 2 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"dependencies": {
"gatsby": "2.23.20",
"gatsby-theme-apollo-docs": "4.3.4",
"ink": "^2.7.1",
"react": "16.12.0",
"react-dom": "16.12.0"
},
Expand Down
4 changes: 2 additions & 2 deletions docs/source/api/react/hoc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const TodoAppWithData = withTodoAppQuery(TodoApp);
export default TodoAppWithData;
```

The `graphql()` function will only be able to provide access to your GraphQL data if there is a [`<ApolloProvider/>`](./hooks/#apolloprovider) component higher up in your tree to provide an [`ApolloClient`](../core/) instance that will be used to fetch your data.
The `graphql()` function will only be able to provide access to your GraphQL data if there is a [`<ApolloProvider/>`](./hooks/#apolloprovider) component higher up in your tree to provide an [`ApolloClient`](../core/ApolloClient/) instance that will be used to fetch your data.

The behavior of your component enhanced with the `graphql()` function will be different depending on if your GraphQL operation is a [query](../../data/queries/), a [mutation](../../data/mutations/), or a [subscription](../../data/subscriptions/). Go to the appropriate API documentation for more information about the functionality and available options for each type.

Expand Down Expand Up @@ -1071,7 +1071,7 @@ export default graphql(
import { withApollo } from '@apollo/react-hoc';
```

A simple enhancer which provides direct access to your [`ApolloClient`](../core/) instance. This is useful if you want to do custom logic with Apollo. Such as calling one-off queries. By calling this function with the component you want to enhance, `withApollo()` will create a new component which passes in an instance of `ApolloClient` as a `client` prop.
A simple enhancer which provides direct access to your [`ApolloClient`](../core/ApolloClient/) instance. This is useful if you want to do custom logic with Apollo. Such as calling one-off queries. By calling this function with the component you want to enhance, `withApollo()` will create a new component which passes in an instance of `ApolloClient` as a `client` prop.

If you are wondering when to use `withApollo()` and when to use [`graphql()`](#graphqlquery-configcomponent) the answer is that most of the time you will want to use `graphql()`. `graphql()` provides many of the advanced features you need to work with your GraphQL data. You should only use `withApollo()` if you want the GraphQL client without any of the other features.

Expand Down
Loading

0 comments on commit 870821d

Please sign in to comment.