Check out example codes for "what function is called just before the a script is ended c#". It will help you in understanding the concepts better.

Code Example 1

OnDisable(){}

Learn ReactJs, React Native from akashmittal.com