# React app REACT\_APP\_ env variables always undefined

**URL:** <https://answers.netlify.com/t/react-app-react-app-env-variables-always-undefined/54965>\
**Category:** Support\
**Tags:** create-react-app, netlify-newbie\
**Created:** [April 14, 2022, 5:46pm UTC](https://answers.netlify.com/t/react-app-react-app-env-variables-always-undefined/54965 "2022-04-14T17:46:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikola-Milovic](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/nikola-milovic/32/36203_2.png) [@Nikola-Milovic](https://answers.netlify.com/u/Nikola-Milovic)\
**Post date:** [April 14, 2022, 5:46pm UTC](https://answers.netlify.com/t/react-app-react-app-env-variables-always-undefined/54965/1 "2022-04-14T17:46:45Z")

</div>

Hello everyone, I have a simple setup, trying to add IS\_STAGING env variable to my app and I did as following

I added an environment variable named `REACT_APP_IS_STAGING` with the value of true, but it’s not getting picked up

But this gives me `undefined`

```auto
console.log(process.env.REACT_APP_IS_STAGING);

```

My app is rather simplistic, created with create-react-app

![image](https://global.discourse-cdn.com/netlify/original/3X/9/e/9e71fc49f871d169d78a511ff0e34293949a15ae.png)

---

<div class="post-metadata">

**Author:** ![fool](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/fool/32/37_2.png) [@fool](https://answers.netlify.com/u/fool)\
**Post date:** [April 18, 2022, 8:47pm UTC](https://answers.netlify.com/t/react-app-react-app-env-variables-always-undefined/54965/2 "2022-04-18T20:47:00Z")

</div>

Of course, that type of variable namespace will only work in case you are actually building a react app; I suppose you are 🙂

If so, it seems likely that your build pipeline somehow ignores your env vars in subprocesses, since that should be set both during build, and after deploy. I wrote an explanation of why this could happen, how to troubleshoot and fix; check out this article but especially the third paragraph for advice that is likely relevant to you:

> [@\[Support Guide\] Using environment variables on Netlify correctly](https://answers.netlify.com/t/support-guide-using-environment-variables-on-netlify-correctly/267):
>
> Last reviewed: August 2023 The preferred way to use environment variables in Netlify is to set them in our environment - be that in the Environment Variables settings UI (on the site’s “Build & Deploy settings” page), or [via netlify.toml](https://docs.netlify.com/configure-builds/file-based-configuration/). You’ll want to choose the right pattern to meet your needs. Setting variables in our UI may be considered a bit more secure, since only people with access to the Netlify admin UI for your site can see them, rather than “anyone who can clone your repo!”. Thes…
