0

I am starting to dive in JavaScript world. Which way is better to reuse JavaScript files/components.

let MainFooter = require('./partials/MainFooter.vue');

or

import MainFooter from './partials/MainFooter.vue'

Which is better to use and when?

Aipo
  • 1,805
  • 3
  • 23
  • 48
  • 2
    Possible duplicate of [Using Node.js require vs. ES6 import/export](https://stackoverflow.com/questions/31354559/using-node-js-require-vs-es6-import-export) – Luca Kiebel Aug 19 '18 at 15:29
  • 1
    I think your question is more “require vs import”. Require inserts the required content at the line it is used, imports are sorted to the top of the file. – Chris Cousins Aug 19 '18 at 15:31

0 Answers0