Allow export page component as named not default
See original GitHub issueIt’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:
- Created 4 years ago
- Reactions:5
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.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.