Is 'export default' better than 'export' in ReactJs

Viewed 39

export default ComponentName And export ComponentName . Is it better to use the default for readability or is the export a recommended choice? Found few tutorials pertaining to react but did not find anyone who differentiated the two.

1 Answers

I don't think there's anything better or worse. Only, export can export multiple modules and export default can export only one module. Therefore, I use export default for page-drawing components and export for js files that have multiple functions defined. I think you can judge and use it according to each situation.

Related