shetty
shetty

Reputation: 9

How to make app constants or env config fetched from the server to be available in all Redux reducers?

In the application I'm working on, we fetch the app constants and env configs from the server. How can these values be accessed across all the reducers?

Upvotes: 0

Views: 59

Answers (2)

iamnat
iamnat

Reputation: 4166

I usually template the env vars into the main html body inside a script tag inside an object called __env. I then import them through a window.__env in my js files.

Upvotes: 0

EQuimper
EQuimper

Reputation: 5929

This is just a thinking but you can make a higher order reducer who wrap this env config and your app constants. Take a look here.

Upvotes: 1

Related Questions