What is the purpose of returning a cleanup function in useEffect?
The cleanup function returned by useEffect is used to clean up after the effect has been applied. This is useful for tasks like unsubscribing from subscriptions or cancelling asynchronous operations.