environment variables not showing in process.env in create react app in js 1

environment variables not showing in process.env in create react app in js

# With create react app, you need to prefix REACT_APP_ to the variable name. ex:
REACT_APP_SOME_API_KEY=some_api_key
REACT_APP_SOME_ENV_VAR=some_env_value

Here is what the above code is Doing:
1. We’re importing the os module.
2. We’re creating a variable called REACT_APP_SOME_API_KEY and assigning it the value of the environment variable SOME_API_KEY.
3. We’re creating a variable called REACT_APP_SOME_ENV_VAR and assigning it the value of the environment variable SOME_ENV_VAR.
4. We’re exporting the variables.

Now, we can use these variables in our React app.

Similar Posts