use-timer: Autostart problems

  const { time, start, pause, reset, isRunning } = useTimer({
    initialTime: 3,
    endTime: 0,
    timerType: "DECREMENTAL"
  });

  useEffect(()=>{
    start();
  }, [start])

How can I make timer to autostart only once, when component is rendered? In this case it is restarting every time.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (13 by maintainers)

Most upvoted comments

I’m writing "use-timer": "thibaultboursier/use-timer#fix-start-function-reference-issue" in dependencies list. It is downloading without any problem, but project is not starting after that.

OK! Thanks for opening this issue. I’ll let you have a look on PR.