React·100 questions

How to avoid memory leaks in React?

Answer
Clear subscriptions in the cleanup effect.
Cancel requests on unmount.
Do not store large objects in global state unnecessarily.
Watch for listeners on window/document.
Use profiling and DevTools.
Was this answer helpful?

More questions in this topic

Related questions from other topics