Hi @suyog mahindrakar,
I'm glad to hear you solve the problem ,if you have any issue about SharePoint, you are welcome to raise a ticket in this forum.
By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others." and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:
[React js and Sharepoint error]
Issue Symptom:
react componets which calls custom api return value can't be null error.
System.AppDomainUnloadedException: Attempted to access an unloaded appdomain. (Exception from HRESULT: 0x80131014)
Solution:
In IIS "Request time" was set to 120 seconds, so if user kept site open for some time and call some api without page refresh, the request was coming as anonymous, hence sharepoint was throwing context is Null. Either we can increase request time out or we have written some code that calls our custom API eevry 90S so context never gets expired.
---You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community member's to see the useful information when reading this thread. Thanks for your understanding!