Simple Answer is
just use this instead of setTime(time-1) inside your function
setTime((time)=>time-1)
This should work, why?-->https://www.theodinproject.com/lessons/node-path-react-new-more-on-state
Checkout the portion of :How State Updates?