Javascript: Group export - yay or nay?

Created on 19 Apr 2018  路  3Comments  路  Source: airbnb/javascript

I was wondering which one is better, to do a group export or do individual exports:

export const a = 1;
export const b = 2;

// vs

const a = 1;
const b = 2;

export {
  a,
  b
}
question

Most helpful comment

for a few exports and a small file I use the second one. For a large file with only named exports I explicitly export each one to reduce mistakes.

All 3 comments

I鈥檓 not sure either is clearly better in every case; so far we鈥檝e been leaving it as a judgement call for the developer.

I like second one

for a few exports and a small file I use the second one. For a large file with only named exports I explicitly export each one to reduce mistakes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kozhevnikov picture kozhevnikov  路  3Comments

surfaceowl picture surfaceowl  路  3Comments

tunnckoCore picture tunnckoCore  路  3Comments

ar
mbifulco picture mbifulco  路  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  路  3Comments