Search
 
SCRIPT & CODE EXAMPLE
 

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'
Comment

.env file example react native

{
  "plugins": [
    ["module:react-native-dotenv"]
  ]
}
Comment

.env file example react native



{
  "presets": ["react-native"],
  "plugins": [
    "transform-inline-environment-variables"
  ]
}


Comment

.env file example react native


{
  "presets": ["react-native"],
  "plugins": [
    "transform-inline-environment-variables"
  ]
}

Comment

PREVIOUS NEXT
Code Example
Javascript :: mdi/js icons with vue 
Javascript :: javascript remove elements from array with value 
Javascript :: Remove an item from the beginning of an Array 
Javascript :: how to use socket io in production 
Javascript :: input mask 9 number add 
Javascript :: axios.get Uncaught (in promise) TypeError: response.json is not a function 
Javascript :: latex sum two lines subscript 
Javascript :: Javascript swap old and new method 
Javascript :: leaflet flyto 
Javascript :: (node:3644) UnhandledPromiseRejectionWarning: TypeError [EMOJI_TYPE]: Emoji must be a string or GuildEmoji/ReactionEmoji 
Javascript :: vue js data bind 
Javascript :: javascript append to object 
Javascript :: javascript function declaration vs arrow function 
Javascript :: phaser aseprite animation 
Javascript :: Using a decrementing For Loop to Reverse an Array 
Javascript :: lodash isequal 
Javascript :: what is ... in javascript 
Javascript :: express ubuntu ERR_CONNECTION_REFUSED 
Javascript :: react native fontsize not affected by phone settings 
Javascript :: javascript count occurence of character in string 
Javascript :: creating room in ws nodejs 
Javascript :: Javascript function method with any number of arguments 
Javascript :: get date in milliseconds javascript 
Javascript :: angular 12 features 
Javascript :: js variable for key obj 
Javascript :: javascript loop backwards 
Javascript :: destructuring 
Javascript :: if text is present make div hide 
Javascript :: convert date format mm/dd/yyyy to yyyymmdd in javascript 
Javascript :: Min JavaScript Methods 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =