export default
↔ Named Export with default name
export default function f() {}
export default class MyClass {}
export default 123 // any value
export default myFunc
export default MyClass
export default Math.sqrt(2)
export default "a" + "b" + "c"
function wasd() {}
export { wasd as default }
default
is illegal Identifier for Variable but can be used as export name (or as Property Key)
Max ONE Default Export allowed for each module
Module itself = default-exported value
Default Export usually for module with single function/class
// export default const not allowed because following would export 1+ value
export default a=1, b=2, c=3
References
loading.tsx
↔ ( Next 13 ) Page toexport default
loading UI on Trigger Suspense Boundarypage.tsx
↔ Pageexport default
UI for Next Route vs dirpath, default Server Component - else"use client"
opt-inlayout.tsx
↔ ( Next 13 ) Page toexport default
layout UI to share withchildren
not-found.tsx
↔ ( Next 13 ) Page toexport default
UI for Catch All Routeerror.tsx
↔ ( Next 13 ) Page toexport default
UI on Trigger Error Boundaryhead.tsx
↔ ( Next 13 ) Page toexport default
<head\>
for each Page Route[id].tsx
↔ ( Next 12 ) FC toexport default
Page with Dynamic Route with_id
URL ParameterStory
↔export default
Object to Declaratively render FC snapshot with specific key state to dev/test/doc
<code>export</code> default {
title "Button",
component: Button
}
<code>export</code> const ButtonRed = () => <Button label="Press me" backgroundColor="red" /\>
Page
↔export default
FC to display unique UI fornext
File System Router