Skip to content

Instantly share code, notes, and snippets.

@toshvelaga
Created March 3, 2022 09:47
Show Gist options
  • Select an option

  • Save toshvelaga/480572cd8058e9927a240fa424324822 to your computer and use it in GitHub Desktop.

Select an option

Save toshvelaga/480572cd8058e9927a240fa424324822 to your computer and use it in GitHub Desktop.
using useInterval
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