Import VS require ? | Sololearn: Learn to code for FREE!

0

Import VS require ?

Can someone please explain to me what's the major difference between import and require

4/13/2020 5:50:49 AM

ezall

4 Answers

New Answer

+2

Dynamic import is ES2020 feature with import() operator, it is asynchronous and it returns a promise. You can import in the code blocks instead of globally, and use .then .catch .final or async await to handle the resolve and reject of the promise.

+1

Thank you soo much for this article it really helped but i have a follow up questions what's a dynamic import what's tree shaking

0

Thank you so much