React Environment Variables

What is ENV 🤔

Do you have to install any plugin to use ENV file 🙄

What if you want to create different Keys for integration and production

1. Customise Environment Variable for build environment

REACT_APP_NAME=XXXX
$ yarn add env-cmd
{   
"scripts": {
"build:integration": "env-cmd -f .env.integration yarn run build"
}
}

What if you want to install devDependencies when NODE_ENV=production 🤔

2. Use ENV variables in HTML

<title>%REACT_APP_NAME%</title>
REACT_APP_NAME=ProjectName

Reference 🧐

Summary ⅀

Frontend Developer sharing JS, HTML, CSS, GoLang🔥 Find all on blog.suprabha.me💛