wooorm / xdm

Just a *really* good MDX compiler. No runtime. With esbuild, Rollup, and webpack plugins
http://wooorm.com/xdm/
MIT License
595 stars 18 forks source link

Fix `Layout` example component #85

Closed mrv1k closed 3 years ago

mrv1k commented 3 years ago

Example used both expression and declaration. README is fairly long so I copy pasted it here. It was this:

export default function Layout({children}) => <main>{children}</main>

All the things.

Considered 3 options: Named function declaration. Verbose but descriptive. (Proposing this one)

export default function Layout({ children }) {
  return <main>{children}</main>;
}

Anonymous arrow function expression. Short but vague, what's the default export used again?

export default ({ children }) => <main>{children}</main>;

Named arrow function expression. Looks weird, export to export?

export const Layout = ({ children }) => <main>{children}</main>;
export default Layout;
wooorm commented 3 years ago

Nice catch, thank you!