Learn how to use React Native with Configu
. We’ll use the Configu CLI
and the Configu ConfigStore
(Configu Platform) to declare, initialize, and export a simple set of configuration data which you can use in your React Native app.
.env
file:
.env
file with more environment variables:
EXPO_PUBLIC_POST_BUTTON_ENABLED
: A feature flag that determines whether the post button is enabled.EXPO_PUBLIC_POST_BUTTON_COLOR
: The color of the post button..env
file. This is not a good practice and can lead to errors. This is where Configu comes in, you can store all your configurations in one place and use the Configu CLI to export the configurations to your .env
file based on the environment you are working on. In the next steps we will show you how to do this.
.env
file you created earlier and set the values as defaults.
expo.cfgu.json
file in your project directory with the following content:
ConfigStore
is a convenient way to get started with Configu, especially for users who are new to the tool. It is a configuration management platform that is easy to use and requires minimal setup, with a free starter plan option.To get started with Configu Platform, you’ll need to register and create a new organization..env
file with the configurations declared in the “expo” ConfigSchema and their values from the “development” ConfigSet.
.env
files with the configurations for those environments.
Staging:
.env
file reflected in your React Native app. If you use a framework other than Expo, you can refer to the documentation of that framework to learn how to use environment variables.