Created
March 3, 2022 09:47
-
-
Save toshvelaga/480572cd8058e9927a240fa424324822 to your computer and use it in GitHub Desktop.
using useInterval
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
| useInterval(() => { | |
| // Your custom logic here | |
| if (isActive) { | |
| API.post('/twitch/view-count', { | |
| twitchUsername: twitchUsername, | |
| twitchAccessToken: twitchAccessToken, | |
| }) | |
| .then((res) => { | |
| console.log(res.data.number) | |
| if (res.data.number) settwitchViewCount(res.data.number) | |
| }) | |
| .catch((err) => console.log(err)) | |
| } else return null | |
| }, twitchViewCountTimer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment