Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

can we use .env in react native?

//Create a new file .env in the root of your React Native app:
//.env
API_URL=https://myapi.com
GOOGLE_MAPS_API_KEY=abcdefgh


//Then access variables defined there from your app :
//app.js
import Config from "react-native-config";

Config.API_URL; // 'https://myapi.com'
Config.GOOGLE_MAPS_API_KEY; // 'abcdefgh'
Source by github.com #
 
PREVIOUS NEXT
Tagged: #react
ADD COMMENT
Topic
Name
3+3 =