How can you prevent memory leaks in React applications?

Memory leaks can be prevented by canceling async calls, clearing timers, using cleanup functions in useEffect, and avoiding excessive DOM elements.