1// Place a filer called .env at the doc root of your project
2/*
3my-react-app/
4 |-node-modules/
5 |-src/
6 |-public/
7 |-.env
8 |-gitignore
9 |-package.json
10 |-package.lock.json.
11 |-README.md
12*/
13// Edit the .env file and create your cusotm Environment Variables
14// DO NOT USE SINGLE OR DOUBLE QUOTES!
15
16REACT_APP_CLIENT_ID=jfjffffaddfeettgydgdffv
17REACT_APP_KEY=aaddddawrfffvvvvssaa
18
19// They will be READ-ONLY from your JS file, you can print them
20// or assign them to other variables
21
22console.log(process.env.REACT_APP_CLIENT_ID);
23console.log(process.env.REACT_APP_KEY);
24
25var id = process.env.REACT_APP_CLIENT_ID;
26var key = process.env.REACT_APP_KEY;
27
1process.env.NODE_ENV gives you either "development" or "production" or "test"
2When you run npm start it is equal to develpment
3When you run npm run build it is equal to production
4When you run npm test it is equal to test