My react app needs to know if the ENV is production or development, and I set it in my .env file on my express server perfectly, but I don't know how to inject that successfully into the client code which needs to know the ENV to determine if the link is localhost or mysite.com
Asked
Active
Viewed 739 times
2 Answers
0
You're going to want to do this in your webpack routine. It can be achieved with the DefinePlugin method: https://webpack.js.org/plugins/define-plugin/

Shadowfool
- 965
- 11
- 21
0
Are you using Webpack or any other module bundler? You can configure Webpack to use a different config dependent on your environment.

carlcheel
- 621
- 6
- 11