Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 22514

how seTimeout() executing continuously?

$
0
0

Since we know that setTimeout() function execute only once then how the following program executing continuously:

import {useState} from "react"const App = () => {        const [counter, setcounter] = useState(0);        setTimeout( () => setcounter (counter+1), 1000)        return (<div>{counter} </div>        )}export default App

please anybody can identify it? which code piece triggering the setTimeout() to execute continuously?


Viewing all articles
Browse latest Browse all 22514

Trending Articles