Aditya Chandrayan Aditya Chandrayan - 1 year ago 89
Node.js Question

Export in react js based on a condition?

I have two loggers but i am facing a problem.
i want something similar to this.
HOwever if i use only one logger without the if case then it works fine.

if(process.env.NODE_ENV === 'DEVELOPMENT')
export default logger_dev;
if(process.env.NODE_ENV === 'PRODUCTION')
export default logger_prod;

Answer Source
const logger = process.env.NODE_ENV === 'PRODUCTION' ? logger_prod : logger_dev;
export default logger;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download