Seemingly a very simple task...
export default function() { return { googleClientID:'xxxx' } }
Is it the best way to export object literal with app settings?
Export Default is used to export only one value from a file which can be a class, function, or object. The default export can be imported with any name.
You can export object itself: export default { googleClientID:'xxxx' }; The difference is that in your case you will get brand new object every time you call exported function. In this case you will get the same object every time.
The export declaration is used to export values from a JavaScript module. Exported values can then be imported into other programs with the import declaration or dynamic import.
You can export object itself:
export default { googleClientID:'xxxx' };
The difference is that in your case you will get brand new object every time you call exported function. In this case you will get the same object every time. Depends on what you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With