javascript - strange issue of undefined in url in UAT env. in local it is working:

Solution:

The Create React App documentation states that you must prefix all environment variables within your .env files with REACT_APP_ for them to be available from within your code process.env.REACT_APP_<variable name>

If you don't want to use REACT_APP_ prefix, you can use env-create-react-app

Answer

Solution:

Try using backticks(``)

For Example : `${process.env.API_URL}/code`

Answer

Solution:

Make sure you have the .env file in your root folder(same place where you have your package.json) and NOT in your src folder.

Answer

Solution:

You mention you changed your environment variables to start with REACT_APP - do you have a trailing underscore? They should start with REACT_APP_.

Source