Sorry for picking up old question, but
react-scripts actually uses dotenv library under the hood.
With [email protected] and higher, you can work with environment variables this way:
- create .env file in the root of the project
- set environment variables starting with REACT_APP_ there
- access it by process.env.REACT_APP_… in components
.env
REACT_APP_BASE_URL=http://localhost:3000
App.js
const BASE_URL = process.env.REACT_APP_BASE_URL;
See docs for more details.