Skip to content

Instantly share code, notes, and snippets.

@luandevpro
Created June 22, 2019 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luandevpro/52328d43e55e7c98d89696d55d40f43c to your computer and use it in GitHub Desktop.
Save luandevpro/52328d43e55e7c98d89696d55d40f43c to your computer and use it in GitHub Desktop.
<button
onClick={() =>
data.fetchMore({
variables: {
offset: data.data.post.length,
},
updateQuery: (prev, { fetchMoreResult }) => {
if (!fetchMoreResult) return prev;
return Object.assign({}, prev, {
post: [...prev.post, ...fetchMoreResult.post],
});
},
})
}
>
refetch
</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment