question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow export page component as named not default

See original GitHub issue

It’s easier to write.

export function Home() {
  return <div>Welcome to Next.js!</div>;
}

Default export sucks. It’s ambiguous. The reason why default export exists is backward interoperability with CommonJS.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
uladkasachcommented, Apr 26, 2020

Would be nice to support this. If a code base has the convention (and lint rules) forbidding default exports, making the codebase have to make an exception for each page is not ideal.

The convention could be to look for a default export and then look for an export named page if not default export is not found.

0reactions
balazsorban44commented, Jan 27, 2022

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow export page component as named not default #8214
The convention could be to look for a default export and then look for an export named page if not default export is...
Read more >
Understanding the Difference Between Named and Default ...
Named and Default exports are not React-centric ideas. ... Named exports allow you to consolidate many related components or modules into one import ......
Read more >
Any possibility to use default export instead of named exports?
Manually removing named exports from generated code and replacing them with export default $$default “resolves” the problem. files. I found ...
Read more >
Avoid ES6 default exports - Rajesh Naroth - Medium
It is very easy to confuse default exports vs named ones while importing from the same package. Ever paused wondering if you have...
Read more >
Why es6 react component works only with "export default"?
Exporting without default means it's a "named export". You can have multiple named exports in a single file. So if you do this,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found