Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

setinterval in react

// don't forget to clean it up:

useEffect(() => {
  const interval = setInterval(() => console.log('hello!'), 1000)
  
  return () => clearInterval(interval) // cleanup
}, [])
Source by upmostly.com #
 
PREVIOUS NEXT
Tagged: #setinterval #react
ADD COMMENT
Topic
Name
2+3 =