score:5

In my case, I have to reference REACT_APP_FACEBOOK_APP_ID environment variable to initialize Facebook SDK inside public/index.html file.

I simply assign the variable to HTML element's property then access it using JavaScript like so:

...
<meta property="fb:app_id" content="%REACT_APP_FACEBOOK_APP_ID%" />

<script>
   const facebookAppId = document.querySelector('[property="fb:app_id"]').content;
   // use `facebookAppId` here
</script>


Related Query

More Query from same tag