Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react native environment variables

# .env files
API_URL=https://myapi.com
GOOGLE_MAPS_API_KEY=abcdefgh

# use env
import Config from 'react-native-config'

Config.API_URL  // 'https://myapi.com'
Config.GOOGLE_MAPS_API_KEY  // 'abcdefgh'

# call env
development: ENVFILE=.env.staging react-native run-android
production: cd android && ENVFILE=.env.production ./gradlew assembleRelease
Comment

PREVIOUS NEXT
Code Example
Javascript :: array push method 
Javascript :: find positive integers javascript 
Javascript :: javascript how to get middle letters of a string 
Javascript :: isotope cdn 
Javascript :: conditional classname prop react 
Javascript :: Array Foreach Loop 
Javascript :: var vs let js 
Javascript :: vuex state from another module 
Javascript :: upload files to express using express-fileupload 
Javascript :: uploading file with fetch 
Javascript :: Javascript Get day number in year from date 
Javascript :: how to ssh into gke node 
Javascript :: unwind check after null or undefined 
Javascript :: jquery header basic auth 
Javascript :: convert 24 hour to 12 hour moment js 
Javascript :: javascript get phone number from string 
Javascript :: js if array is 2d 
Javascript :: insertadjacenthtml javascript 
Javascript :: jquery on form submit call function 
Javascript :: if else dart 
Javascript :: how to set env variables in js 
Javascript :: object clone javascript 
Javascript :: round number at 2 decimal places 
Javascript :: js parse json 
Javascript :: react current path 
Javascript :: vue js computed 
Javascript :: chrome.storage.local get 
Javascript :: force click btn using jquery 
Javascript :: adding js file to reactjs 
Javascript :: fetch Response object get content type 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =