Check out example codes for "what is interrupt handling". It will help you in understanding the concepts better.
Code Example 1
An interrupt handler is just a routine containing a sequence of operations. Each of these may request input and output while running.
Learn ReactJs, React Native from akashmittal.com