docs for App component
This commit is contained in:
parent
01c3f1f2fa
commit
5371cbbd4a
1 changed files with 14 additions and 0 deletions
|
@ -5,16 +5,30 @@ import WardrobePage from "./WardrobePage";
|
||||||
|
|
||||||
import ApolloClient from "apollo-boost";
|
import ApolloClient from "apollo-boost";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* client is the global Apollo Client instance we use for GraphQL queries. This
|
||||||
|
* is how we communicate with the server!
|
||||||
|
*/
|
||||||
const client = new ApolloClient({
|
const client = new ApolloClient({
|
||||||
uri: "/api/graphql",
|
uri: "/api/graphql",
|
||||||
cacheRedirects: {
|
cacheRedirects: {
|
||||||
Query: {
|
Query: {
|
||||||
|
// Teach Apollo how to serve `items` queries from the cache. That way,
|
||||||
|
// when you remove an item from your outfit, or add an item from search,
|
||||||
|
// Apollo knows it already has the data it needs and doesn't need to ask
|
||||||
|
// the server again!
|
||||||
items: (_, args, { getCacheKey }) =>
|
items: (_, args, { getCacheKey }) =>
|
||||||
args.ids.map((id) => getCacheKey({ __typename: "Item", id })),
|
args.ids.map((id) => getCacheKey({ __typename: "Item", id })),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App is the entry point of our application. There's not a ton of exciting
|
||||||
|
* stuff happening here, mostly just setting up some globals and theming!
|
||||||
|
*
|
||||||
|
* To really dive into the code, try going down into a page component!
|
||||||
|
*/
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<ApolloProvider client={client}>
|
<ApolloProvider client={client}>
|
||||||
|
|
Loading…
Reference in a new issue