Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

hide urls in .env in react app

WARNING: Do not store any secrets (such as private API keys) in your React app!

Environment variables are embedded into the build, meaning anyone can view them by inspecting your app's files.

outside our src folder create .env file and add it to gitignore
REACT_APP_WEATHER_API_KEY=123456
inside where you want to access the variable 
const API_KEY = process.env.REACT_APP_WEATHER_API_KEY;

make sure to restart the server
Comment

PREVIOUS NEXT
Code Example
Javascript :: foreach js 
Javascript :: mathjax arrow 
Javascript :: change a css class in javascript 
Javascript :: Google App Script getSheetByName 
Javascript :: react add splite image 
Javascript :: hook use effect with hooks 
Javascript :: mongoose get elements that contain substring 
Javascript :: axios post query params 
Javascript :: how to create object js 
Javascript :: react features 
Javascript :: puppeteer example multiple file upload 
Javascript :: javascript sleep 1 minute 
Javascript :: why sort is not working in javascript 
Javascript :: event delegation javascript 
Javascript :: Device detector in react js 
Javascript :: js text match 
Javascript :: a function that returns a string javascript 
Javascript :: loading page for all ajax call in jquery 3.3.1 
Javascript :: axios put request 
Javascript :: copy array of object in js 
Javascript :: nestjs framwork 
Javascript :: perfect scrollbar jquery 
Javascript :: angularjs - controllerAs 
Javascript :: node js code for saving first middle and last name 
Javascript :: post method in javascript 
Javascript :: isodate mongodb nodejs 
Javascript :: how to use react-native-vector-icons 
Javascript :: discord js invite to channel 
Javascript :: useref array 
Javascript :: spotify uri 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =