useEffect

What is the purpose of returning a cleanup function in useEffect?