amrlabib / react-timer-hook

React timer hook

Home Page:https://www.npmjs.com/package/react-timer-hook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timer automatically starts

BronzW opened this issue · comments

Is there a way to wait for it to start until I call the start() function or does it always automatically start on initialization?

Yeah right now for useTimer it will start automatically on initialization

is there a way to avoid that? just calling pause() won't work because it pauses on every rerender

and why isn't there an autostart property on useTirmer too? useStopwatch has it.

@BronzW Did you find a way to solve it? I'm having this problem too

@rony646 I paused it on componentDidMount, not the cleanest thing but works

I added autoStart to useTimer, it should be available from v3.0.2 by default the timer will start automatically, so you will need to set the autoStart value to false