DEV Community

loading...

Discussion on: Environment files in React.js app

Collapse
chilupa profile image
Pavan Chilukuri • Edited

Nice write up! I believe creating an .env file and adding keys like REACT_APP_API_KEY=XXX should do the trick.
May I know why would we need to install env-cmd package that you are referring to?

Collapse
samirasaad profile image
samira saad Author

Hello pavan,

we need cmd-env to tell the script which env file it should read from
For example:

our start should read from stage file as mentioned in the article but if we need to develop with the variables of the production locally you will make your start script read from the production env file

which is can't be done without cmd-env or similar package