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.
This needlessly increases the API surface of Next.js, considering you shouldn't be ever self-importing your pages.
How would Next.js know what export is your page? Default is the only safe assumption.
Thanks for the suggestion, though.
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.
Most helpful comment
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
pageif not default export is not found.