Thursday, 13 April 2017

Why is "import Foo from ‘foo/Foo’" better than "import {Foo} from ‘foo’"

Yo!

So I read an article about react best practices and I stumbled upon this...

Always look at your bundle size One tip to making your bundle way smaller is to import directly from the node module root path.

Do this:

import Foo from ‘foo/Foo’

instead of:

import {Foo} from ‘foo’

My question is... Why and just how much does it help? I tried googling, but I honestly didn't even know what to google for so I didn't find much... And so here I am, hoping someone can clear this up...



via Kirito

No comments:

Post a Comment