In your experience what's the best practice when importing large modules into your component. Could you please tell me which and the reason why from the example below?
import * from './foo'
or
import {bar, beer, brew } from './foo'
In your experience what's the best practice when importing large modules into your component. Could you please tell me which and the reason why from the example below?
import * from './foo'
or
import {bar, beer, brew } from './foo'
import * as name from './foo'
will import everything from foo
, but the second statement will only import three exports from the module.
It's very context specific, but in my opinion it's much easier to see what is actually imported in the second example, and you will also be able to take advantage of tree shaking
if e.g. not all exports from a library are used.