DEV Community

ViGnEsH
ViGnEsH

Posted on

useEffect

June 01 2026

What is useEffect?

The useEffect hook is a built-in React function component. useEffect accepts two arguments. The second argument is optional.
useEffect ( < function >, < dependency > )

Example

API calls
Updating document title
Event listeners
Timers (setTimeout, setInterval)

setTimeout:

setTimeout() = runs only once after the given time.

setInterval

setInterval() = repeats again and again


Top comments (0)