create-react-app-docker-environment-variables icon indicating copy to clipboard operation
create-react-app-docker-environment-variables copied to clipboard

using window.env in a component

Open emrahcetiner opened this issue 4 years ago • 0 comments

Hi @axelhzf

Your approach is great for 12 factors. 👍 However, if I use window.env in a component instead of printing on the page, it doesn't work.

<pre>
   {JSON.stringify(window.ENV, null, 2)}   // <--- it works well
</pre>

<a
  className="App-link"
  href={window.ENV.MY_URL}                 // <--- it doesn't work.
  target="_blank"
  rel="noopener noreferrer"
>
  Learn React
</a>

What do you think about this situation?

emrahcetiner avatar Jun 28 '20 10:06 emrahcetiner