Check out example codes for ".net core check if linux". It will help you in understanding the concepts better.

Code Example 1

if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
    Console.WriteLine("We're on macOS!");
}

Learn ReactJs, React Native from akashmittal.com