Dynamically change environment variables in React?

Viewed 3001

I am trying to deploy my app but I was wondering if there is a way to dynamically update the environment variables without rebuilding my app. I did some research and found out there are 3 possible ways

  • Store configs inside a js file and update that with a script!
  • Store configs in the server that loads the React app and access the variables via an endpoint
  • Store configs in the window object, this is really strange!

Are these methods secure? What are the risks associated with these methods?

Any idea how Facebook, Airbnb or any other high volume websites update their configurations? I mean it would be pretty time consuming to rebuild the application every time right? Is it even a good idea to dynamically update my variables?

I would really appreciate it if you could help me with this!

0 Answers
Related