This is a cleanup function to properly manage the timer. Without this the logic in your useEffect may re-run before the previous timer has been cleared. So if timers run in parallel you may see rapid increments in your count. And it also causes memory leak.
And also, you're not returning the value from the cleartimeout, but returning it as a cleanup function for the useEffect.