Check out example codes for "stop unity editor playing". It will help you in understanding the concepts better.

Code Example 1

//C# public static class AppHelper
{     
  #if UNITY_WEBPLAYER     
    public static string webplayerQuitURL = "http://google.com";
  #endif     
    
  public static void Quit()     
  {         
    #if UNITY_EDITOR         
      UnityEditor.EditorApplication.isPlaying = false;                
    #endif     
    } 
}

Learn ReactJs, React Native from akashmittal.com