ctrlplusb / react-universally

A starter kit for universal react applications.
MIT License
1.7k stars 244 forks source link

Accessing variables from config on client side #483

Closed mb8z closed 7 years ago

mb8z commented 7 years ago

Is it possible?

I want to set for example an API base URL as env var and pass it down. When I try to console.log it from anywhere using the config method I get undefined (as it seems that how the config method works).

jordmccord commented 7 years ago

Yes, you need to add the key that you want to expose to the clientConfigFilter key in the config/values.js file, you'll see some examples like polyfillIO and htmlPage.

mb8z commented 7 years ago

Thanks. It was a stupid question as I noticed that the boilerplate comes with env vars used to display hello message.