React
Overview
![](/assets/images/react-logo-d565c859af43b229e1779dca95c783aa.png)
Injecting Variables At Build Time
React recognizes either environment variables or variables defined in a .env
file located at the project root. React only recognizes variables which begin with REACT_APP_
export REACT_APP_SERVER_URL="www.myserver.com/api"
Environment variables take precedence over those defined in the .env
file.
Imported variables are available in the React environment under process.env
:
console.log(process.env.REACT_APP_SERVER_URL)
// stdout: www.myserver.com/api