create react environment variables code example
Example 1: react environment variables
REACT_APP_CLIENT_ID=jfjffffaddfeettgydgdffv
REACT_APP_KEY=aaddddawrfffvvvvssaa
console.log(process.env.REACT_APP_CLIENT_ID);
console.log(process.env.REACT_APP_KEY);
var id = process.env.REACT_APP_CLIENT_ID;
var key = process.env.REACT_APP_KEY;
Example 2: create-react-app enviroment variables
process.env.NODE_ENV gives you either "development" or "production" or "test"
When you run npm start it is equal to develpment
When you run npm run build it is equal to production
When you run npm test it is equal to test