I'm trying to build a counter with two button start and stop, everything works great but when i want to add a function to change state on the (onClick) the counter restart every time the state changes.
I think it's because rerenders <Countdown />
component every time setState
happens. To fix this
const date = React.useMemo(()=> {return (Date.now() + 1200000)}, []);
...
<CountDown
...
data={date}
...
/>