Front end developer specialising in JavaScript and React. Experienced in all aspects of modern front end development. Passionate about making accessible, secure and performant software.
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:
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