Created
May 16, 2018 02:55
-
-
Save dburles/c8a6921fcfd4c0f40a9f805d0c9fd437 to your computer and use it in GitHub Desktop.
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
| class Polling extends React.Component { | |
| componentDidMount() { | |
| this.intervalId = setInterval(this.props.callback, this.props.interval); | |
| } | |
| componentWillUnmount() { | |
| clearInterval(this.intervalId); | |
| } | |
| render() { | |
| return this.props.children; | |
| } | |
| } |
I'm pretty sure that loads of the same query that is in flight await the inflight request instead of sending a new request. So it should be safe to aggressively poll?
Author
That looks good
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Perhaps you could use that something like this: