What are the differences between the following two methods, please?
eg1: const router = new vueRouter({...}) export default router
eg2: export const router = new vueRouter({...})
What are the differences between the following two methods, please?
eg1: const router = new vueRouter({...}) export default router
eg2: export const router = new vueRouter({...})
For further actions, you may consider blocking this person and/or reporting abuse
Yogesh Chavan -
Micael Levi L. C. -
CoderHXL -
Geoffrey Kim -
Top comments (2)
First one is a default export. You can import it in another file with any name you like. For example,
foo
,bar
,anythingYouWant
, etc.Example:
The bottom one is a named export. It's missing the keyword
default
. You need to import that one with the correct name and with curly braces, like this:More information at: developer.mozilla.org/en-US/docs/w...
thank u. ok, I got it. So this is why I can't use 'router' in another JS file when I did as same as method 2