DEV Community

Discussion on: React: Class Component VS Function Component with Hooks

Collapse
 
devesh198 profile image
Devesh Gupta

If setTime() is added to useEffect() then it'll have to be added as a dependence also. This could trigger useEffect many times if setTime() is used else where and create an endless loop.