- In the GitHub GraphQL Explorer, create a query to return the last five open issues in the React project. Return the issue title and the URL in the response:
query {
repository (owner:"facebook", name:"react") {
issues(last: 5, states:[OPEN]) {
edges {
node {
title
url
}
}
}
}
}
- Enhance the last query, make the number of issues that is returned a parameter, and make this default to 5:
query ($lastCount: Int = 5) {
repository (owner:"facebook", name:"react") {
issues(last: $lastCount, states: [OPEN]) {
edges {
node {
title
url
}
}
}
}
}
- Create a mutation in the GitHub GraphQL Explorer to unstar a starred repository. The mutation should take a repository ID as a parameter:
mutation ($repoId: ID!) {
removeStar(input: { starrableId: $repoId }) {
starrable {
stargazers {
totalCount
}
}
}
}
- What part of the HTTP request does the GraphQL query go in?
The HTTP body
- What part of the HTTP request does the GraphQL mutation go in?
The HTTP body
- How can we make the response from the react-apollo Query component type safe?
Create another component that extends Query passing in a type for the result as a generic parameter:
class MyQuery extends Query<IResult> {}
We can then use the MyQuery component in our JSX.
- Is caching on or off by default when you scaffold a project with react-boost?
On
- What prop can we use on the Mutation component to update the local cache?
The update prop.