React · Senior · Question 19 of 75

Which of these scenarios causes a memory leak in a React app?

Explanation

The handler holds a closure with the component's data, which isn't freed after unmounting; repeated mounts accumulate subscriptions. Similar sources: uncleared timers, unbounded global caches, references to detached DOM nodes. Find them with Memory snapshots in DevTools.

Further reading

Problem with a question

React · Senior · question 19

Test yourself

Take the React · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz