# Making setInterval Declarative with React Hooks

DevFeed: [Making setInterval Declarative with React Hooks](<https://devfeed.tech/articles/making-setinterval-declarative-with-react-hooks-36178.md>)

Original publisher: [Read original article](<https://overreacted.io/making-setinterval-declarative-with-react-hooks/>)

Published: 2019-02-04T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dan Abramov](<https://devfeed.tech/sources/dan-abramov.md>)

Topics: [React Hooks](<https://devfeed.tech/topics/react-hooks.md>), [React](<https://devfeed.tech/topics/react.md>), [hooks](<https://devfeed.tech/topics/hooks.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [declarative](<https://devfeed.tech/tags/declarative.md>), [hooks](<https://devfeed.tech/tags/hooks.md>), [react](<https://devfeed.tech/tags/react.md>), [react-hooks](<https://devfeed.tech/tags/react-hooks.md>), [refs](<https://devfeed.tech/tags/refs.md>)

## AI overview

This tutorial explains how to use a custom React Hook to make setInterval work with React's programming model. It covers interval setup and cleanup, the relationship between intervals and component lifecycle, and how dynamic arguments enable adjustable delays.

## Source excerpt

How I learned to stop worrying and love refs.