Last active
February 25, 2021 16:17
-
-
Save jonnysamps/f518cd56ba6e554a43329392204d0c71 to your computer and use it in GitHub Desktop.
Apollo Client Best Practices - 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const query = gql`...`; | |
const watchQuery = apollo.watchQuery({ query }); | |
watchQuery.valueChanges | |
.pipe( | |
map(result => result.data) | |
) | |
.subscribe(() => { | |
// ... | |
}); | |
// Can set it up to poll or just call it when needed. | |
setInterval(() => watchQuery.refetch(), REFRESH_INTERVAL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment