create-react-app-docker-environment-variables
create-react-app-docker-environment-variables copied to clipboard
using window.env in a component
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?