Do variables declared outside React functional component get destroyed/deleted/garbage collected when component unmounts? Do they create memory leaks?

Viewed 113

I want to put some variables outside the functional component because I don't want them to get re-initialized on re-render. I am wondering how they will get cleared from the memory.

0 Answers
Related