Hey there, I'm folowing tutorial @howtographql <ht...
# prisma-whats-new
k
Hey there, I'm folowing tutorial @howtographql https://www.howtographql.com/react-apollo/6-more-mutations-and-updating-the-store/ and could someone explain how clicking 'Vote' button increases that vote by +1 ?
d
Clicking the button leads to the createVote mutation being called, which adds a new Vote node to the graph.cool database
The apollo store is then updated with the new list of vots for the link
The Link component uses the length of the list of votes to show the vote count, so this number increases by one
p
what he said. But just note that the reason apollo store is updated without you explicitly doing anything is because of the mutation callback having the vote in there (as specified within the mutation)
that is something that took me a while to figure out. I always used refetchQueries and my mutation didnt have naything as I didnt actually do anything with the promise callback using react-apollo
k
thanks guys. 🙂