How to store Configuration file and read it using React?

Posted by Prem Tiwari | Updated on

If you want to store Configuration file and read it using React? With webpack you can put env-specific config into the externals field in webpack.config.js

If you want to store the configs in a separate JSON file, that’s possible too, you can require that file and assign to Config:

Then in your modules, you can use the config:

For ReactJS


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers