Check out example codes for "rails don't render if in test environment". It will help you in understanding the concepts better.

Code Example 1

Rails.env.production?
#or
Rails.env.development?
#or
Rails.env.test?

Learn ReactJs, React Native from akashmittal.com