I'm doing a slider with a progress countdown bar, every 10s the slider show the next image.. basically, the problem is that I need to set the time 10s every time the dispatch fired off

at the moment is keeping the same seconds so if you wait 3 seconds 9,8,7 and you click next, it shows the next image but the time starts at 7, I need to set the time when the reduces is called 

how can I call setCount when the reducer is called is my question?

```
const initialState = {scene: 0};

function reducer(state, action) {

    switch (action.type) {
      case 'next':        
        //setCount()====> 'setCount' is not defined
        return {scene: state.scene + 1};
      case 'prev':
        return {scene: state.scene - 1};
      default:
        throw new Error();
    }
}

function App() {
    const limitSlider = 17
    const initialCount = 10
    const [state, dispatch] = useReducer(reducer, initialState);
    const [currentCount, setCount] = useState(initialCount);

    useEffect(
        () =>{
            const timer = () => setCount(currentCount - 1);

            if (currentCount <= 0) {

                //stop countdown 
                if ( state.scene === limitSlider) return

                //change to the next scene
                dispatch( {type: 'next'} )

                //set count
                setCount(10)
                return;
            }

            //reset interval
            const id = setInterval(timer, 1000);
            return () => clearInterval(id);
    },[currentCount, state.scene])

    return (
        <>

                scene: {state.scene} time: {currentCount}

                <button onClick={() => dispatch({type: 'prev' })} disabled={state.scene === 0}>-</button>
                <progress max="" value={`${currentCount}%`}> </progress> // progress is not working need to figure it out first the seconds
                <button onClick={() => dispatch({type: 'next'})} disabled={state.scene === limitSlider}>+</button>

        </>
  );
}

```

sorry I tried to compile it using the prebuilt snippet from stackoverflow, but had some errors