November 2018
Beginner
502 pages
10h 22m
English
Let's allow users to star a GitHub repository in our app. This will involve sending a mutation via Apollo:
import { Mutation } from "react-apollo";
const STAR_REPO = gql` mutation($repoId: ID!) { addStar(input: { starrableId: $repoId }) { starrable { stargazers { totalCount } } } }`;
<p>{repo.description}</p><div> {!repo.viewerHasStarred && ( <Mutation mutation={STAR_REPO} variables={{ repoId: repo.id }} > {() => ( // render Star button that invokes ...Read now
Unlock full access