New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update translation "your first component" & " importing and exporting components" #398
Conversation
|
||
In [Your First Component](/learn/your-first-component), you made a `Profile` component and a `Gallery` component that renders it: | ||
在 [你的第一個 Component](/learn/your-first-component) 中,你建立了一個 `Profile` component,並且 render 在 `Gallery` component 裡: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在 [你的第一個 Component](/learn/your-first-component) 中,你建立了一個 `Profile` component,並且 render 在 `Gallery` component 裡: | |
在[你的第一個 Component](/learn/your-first-component) 中,你建立了一個 `Profile` component,並且 render 在 `Gallery` component 裡: |
* 什麼是 root component 檔案 | ||
* 如何 import / export 一個 component | ||
* 何時使用預設和具名 import / export | ||
* 如何從一個檔案 import / export 多個 component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 如何從一個檔案 import / export 多個 component | |
* 如何從一個檔案 import 和 export 多個 component |
* How to split components into multiple files | ||
* 什麼是 root component 檔案 | ||
* 如何 import / export 一個 component | ||
* 何時使用預設和具名 import / export |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverse default
and named
keyword
* 何時使用預設和具名 import / export | |
* 何時使用 default 和 named import 和 export |
@@ -1,26 +1,26 @@ | |||
--- | |||
title: Importing and Exporting Components | |||
title: Importing 及 Exporting Component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title: Importing 及 Exporting Component | |
title: Importing 和 Exporting Component |
|
||
## Exporting and importing a component {/*exporting-and-importing-a-component*/} | ||
## Importing 與 Exporting 一個 component {/*exporting-and-importing-a-component*/} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Importing 與 Exporting 一個 component {/*exporting-and-importing-a-component*/} | |
## Exporting 和 importing 一個 component {/*exporting-and-importing-a-component*/} |
|
||
You may use either a default or a named export for `Profile`, but make sure that you use the corresponding import syntax in both `App.js` and `Gallery.js`! You can refer to the table from the deep dive above: | ||
你可能會使用預設 export 或具名 export 的方式來 export `Profile`,但請確保在 `App.js` 與 `Gallery.js` 中使用了相對應的 import 語法!具體方法可參考下方表格: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你可能會使用預設 export 或具名 export 的方式來 export `Profile`,但請確保在 `App.js` 與 `Gallery.js` 中使用了相對應的 import 語法!具體方法可參考下方表格: | |
你可能會使用 default export 或 named export 的方式來 export `Profile`,但請確保在 `App.js` 與 `Gallery.js` 中使用了相對應的 import 語法!具體方法可參考下方表格: |
| ----------- | ----------- | ----------- | | ||
| Default | `export default function Button() {}` | `import Button from './Button.js';` | | ||
| Named | `export function Button() {}` | `import { Button } from './Button.js';` | | ||
| 預設 | `export default function Button() {}` | `import Button from './Button.js';` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 預設 | `export default function Button() {}` | `import Button from './Button.js';` | | |
| Default | `export default 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';` | | ||
| 預設 | `export default function Button() {}` | `import Button from './Button.js';` | | ||
| 具名 | `export function Button() {}` | `import { Button } from './Button.js';` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 具名 | `export function Button() {}` | `import { Button } from './Button.js';` | | |
| Named | `export function Button() {}` | `import { Button } from './Button.js';` | |
|
||
<Solution> | ||
|
||
This is the solution with named exports: | ||
具名 export 的解決方法: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
具名 export 的解決方法: | |
Named export 的解決方法: |
@@ -367,7 +367,7 @@ img { margin: 0 10px 10px 0; height: 90px; } | |||
|
|||
</Sandpack> | |||
|
|||
This is the solution with default exports: | |||
預設 export 的解決方法: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
預設 export 的解決方法: | |
Default export 的解決方法: |
Due to numerous conflicts with my previous version, I have forked the file again and executed it using the new file. I have pushed the updated version of "your first component" & " importing and exporting components". As mentioned in the previous review, I have presented all the import/export/root components using the original text format. Thank you.