Run a function on an interval that you can start and stop.
This is custom React hooks, you need to follow the Basic Rules when you use it.
A counter that ticks every second until you stop it.
const useInterval = (
fn: () => void,
interval: number,
options?: { autoInvoke?: boolean },
) => {
start: () => void
stop: () => void
toggle: () => void
active: boolean
}