Browse Source

Fix casing for consistency (#5881)

There's 5 instances in this document in which the casing of a file name
begins with lower case, which makes it inconsisnent both with the page
and the entire tutorial.
main
Joshua 2 years ago
committed by GitHub
parent
commit
b19af544db
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/content/learn/importing-and-exporting-components.md

10
src/content/learn/importing-and-exporting-components.md

@ -138,10 +138,10 @@ How you export your component dictates how you must import it. You will get an e
| Syntax | Export statement | Import statement |
| ----------- | ----------- | ----------- |
| Default | `export default function Button() {}` | `import Button from './button.js';` |
| Named | `export function Button() {}` | `import { Button } from './button.js';` |
| Default | `export default function Button() {}` | `import Button from './Button.js';` |
| Named | `export function Button() {}` | `import { Button } from './Button.js';` |
When you write a _default_ import, you can put any name you want after `import`. For example, you could write `import Banana from './button.js'` instead and it would still provide you with the same default export. In contrast, with named imports, the name has to match on both sides. That's why they are called _named_ imports!
When you write a _default_ import, you can put any name you want after `import`. For example, you could write `import Banana from './Button.js'` instead and it would still provide you with the same default export. In contrast, with named imports, the name has to match on both sides. That's why they are called _named_ imports!
**People often use default exports if the file exports only one component, and use named exports if it exports multiple components and values.** Regardless of which coding style you prefer, always give meaningful names to your component functions and the files that contain them. Components without names, like `export default () => {}`, are discouraged because they make debugging harder.
@ -257,8 +257,8 @@ You may use either a default or a named export for `Profile`, but make sure that
| Syntax | Export statement | Import statement |
| ----------- | ----------- | ----------- |
| Default | `export default function Button() {}` | `import Button from './button.js';` |
| Named | `export function Button() {}` | `import { Button } from './button.js';` |
| Default | `export default function Button() {}` | `import Button from './Button.js';` |
| Named | `export function Button() {}` | `import { Button } from './Button.js';` |
<Hint>

Loading…
Cancel
Save