Maxime Julian
Jun 16, 2021

Hey Nabil,

Thanks for you kind words!

On the React Native side (I assume you're talking about the Javascript code), you can detect what environment the app is running in using the variable we added to each .env file and the config package:

import Config from "react-native-config";

console.log(Config.ENVIRONMENT);

Now that you know what environment the app is running in, you can enable specific features and render specific components for each environment.

For example, if you wanted to enable analytics in production only, you could do something like this:

import Config from "react-native-config";

if (Config.ENVIRONMENT === 'production') {

enableAnalytics();

}

You can use this logic to render components/part of your app in specific environments only, thus enabling some functionalities in specific environments and disabling them in others.

I hope this helps!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Maxime Julian
Maxime Julian

Written by Maxime Julian

Developer hooked on blockchain technologies 👷 Creator of eth-graphql (https://github.com/therealemjy/eth-graphql)

Responses (1)

Write a response