Skip to content
Discussion options

You must be logged in to vote

Would it be best to call the mutation.mutate inside of a setInterval?

yep, that sounds fine. have a look at the useInterval hook from Dan: https://overreacted.io/making-setinterval-declarative-with-react-hooks/

alternatively, you could debounce the value you want to persist and call the mutation in an effect e.g. 1 second after the last change has been made, thus only saving when there is a real change. see this useDebounce hook: https://usehooks.com/useDebounce/

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rjgux
Comment options

Answer selected by rjgux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants