Skip to content

Commit 04be05a

Browse files
fix: resolved immense conflicts
Signed-off-by: Jie Peng <[email protected]>
1 parent bce8dec commit 04be05a

12 files changed

+107
-455
lines changed

beta/src/pages/learn/add-react-to-a-website.md

Lines changed: 45 additions & 185 deletions
Large diffs are not rendered by default.

beta/src/pages/learn/editor-setup.md

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,22 @@ title: 編輯器設定
88

99
</Intro>
1010

11-
<<<<<<< HEAD
12-
## 你的編輯器 {/*your-editor*/}
13-
=======
1411
<YouWillLearn>
1512

16-
* What the most popular editors are
17-
* How to format your code automatically
13+
* 最受歡迎的編輯器是誰
14+
* 如何自動格式化你的程式碼
1815

1916
</YouWillLearn>
2017

21-
## Your editor {/*your-editor*/}
22-
>>>>>>> 26a870e1c6e232062b760d37620d85802750e985
18+
## 你的編輯器 {/*your-editor*/}
2319

2420
[VS Code](https://code.visualstudio.com/) 是現在最受歡迎的編輯器之一。它有一個龐大的擴充功能市集,並與 GitHub 等流行服務很好的整合。下面列出的大多數功能也可以作為擴充功能加入到 VS Code 中,使其具有高度的可性!
2521

2622
其他在 React 社群使用的流行文字編輯器包括:
2723

28-
<<<<<<< HEAD
29-
* [WebStorm](https://www.jetbrains.com/webstorm/)—一個專門為 JavaScript 設計的完整開發環境。
30-
* [Sublime Text](https://www.sublimetext.com/)—支援 JSX 和 TypeScript、[語法高亮](https://stackoverflow.com/a/70960574/458193)和自動補全功能。
31-
* [Vim](https://www.vim.org/)—是一個高度可配置的文字編輯器,可以非常有效的建立和修改任何類型的文本。它作為「vi」被內建在大多數 UNIX 系統和蘋果 OS X 系統中。
32-
=======
33-
* [WebStorm](https://www.jetbrains.com/webstorm/) is an integrated development environment designed specifically for JavaScript.
34-
* [Sublime Text](https://www.sublimetext.com/) has support for JSX and TypeScript, [syntax highlighting](https://stackoverflow.com/a/70960574/458193) and autocomplete built in.
35-
* [Vim](https://www.vim.org/) is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as "vi" with most UNIX systems and with Apple OS X.
36-
>>>>>>> 26a870e1c6e232062b760d37620d85802750e985
24+
* [WebStorm](https://www.jetbrains.com/webstorm/) 是一個專門為 JavaScript 設計的完整開發環境。
25+
* [Sublime Text](https://www.sublimetext.com/) 支援 JSX 和 TypeScript,內建 [syntax highlighting](https://stackoverflow.com/a/70960574/458193) 和 autocomplete。
26+
* [Vim](https://www.vim.org/) 是一個高度可配置的文字編輯器,可以非常有效的建立和修改任何類型的文本。它作為「vi」被內建在大多數 UNIX 系統和 Apple OS X 系統中。
3727

3828
## 推薦的文字編輯器功能 {/*recommended-text-editor-features*/}
3929

@@ -52,36 +42,19 @@ Code linter 可以在你撰寫程式碼的時候發現問題,幫助你儘早
5242

5343
你可以透過以下幾個步驟安裝[在 VSCode 內安裝 Prettier 擴充套件](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
5444

55-
<<<<<<< HEAD
5645
1. 啟動 VS Code
57-
2. 使用快速開啟(按下 `CTRL/CMD + P`
46+
2. 使用快速開啟(按下 `CTRL/Cmd + P`
5847
3. 貼上 `ext install esbenp.prettier-vscode`
5948
4. 按下 enter
60-
=======
61-
1. Launch VS Code
62-
2. Use Quick Open (press Ctrl/Cmd+P)
63-
3. Paste in `ext install esbenp.prettier-vscode`
64-
4. Press Enter
65-
>>>>>>> 26a870e1c6e232062b760d37620d85802750e985
6649

6750
#### 儲存時格式化 {/*formatting-on-save*/}
6851

6952
理想情況下,你應該在每次儲存時對你的程式碼進行格式化。 在 VS Code 可以設定!
7053

71-
<<<<<<< HEAD
7254
1. 在 VS Code 內,按下 `CTRL/CMD + SHIFT + P`
7355
2. 輸入「settings」
7456
3. 按下 enter
7557
4. 在搜尋欄中,輸入「format on save」
7658
5. 確認「format on save」選項是打勾的!
7759

78-
> Prettier 有時會與其他的 linter 衝突。但通常有辦法讓它們可以很好的一起執行。例如,如果你使用 Prettier 和 ESLint,你可以使用 [eslint-prettier](https://github.com/prettier/eslint-plugin-prettier) 擴充套件來執行 prettier 作為 ESLint 規則。
79-
=======
80-
1. In VS Code, press `CTRL/CMD + SHIFT + P`.
81-
2. Type "settings"
82-
3. Hit Enter
83-
4. In the search bar, type "format on save"
84-
5. Be sure the "format on save" option is ticked!
85-
86-
> If your ESLint preset has formatting rules, they may conflict with Prettier. We recommend to disable all formatting rules in your ESLint preset using [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) so that ESLint is *only* used for catching logical mistakes. If you want to enforce that files are formatted before a pull request is merged, use [`prettier --check`](https://prettier.io/docs/en/cli.html#--check) for your continuous integration.
87-
>>>>>>> 26a870e1c6e232062b760d37620d85802750e985
60+
> 如果你的 ESLint 預設有格式規則,它們可能與 Prettier 衝突。我們建議使用 [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) 禁用 ESLint 預設中的所有格式規則,以便 ESLint **用於捕獲邏輯錯誤。如果你想強制在 pull request 被合併之前,對程式碼進行格式化,在你的 continuous integration 中使用 [`prettier --check`](https://prettier.io/docs/en/cli.html#--check)

beta/src/pages/learn/react-developer-tools.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@ title: React 開發者工具
88

99
</Intro>
1010

11-
<<<<<<< HEAD
12-
## 瀏覽器擴充元件 {/*browser-extension*/}
13-
=======
1411
<YouWillLearn>
1512

16-
* How to install React Developer Tools
13+
* 如何安裝 React Developer Tools
1714

1815
</YouWillLearn>
1916

2017
## Browser extension {/*browser-extension*/}
21-
>>>>>>> 26a870e1c6e232062b760d37620d85802750e985
2218

2319
要 debug 用 React 建構的網站最簡單的方式是安裝 React 開發者瀏覽器擴充元件。它可以在一些流行的瀏覽器上使用:
2420

beta/src/pages/learn/start-a-new-react-project.md

Lines changed: 29 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,32 @@ title: 開始一個新的 React 專案
44

55
<Intro>
66

7-
<<<<<<< HEAD
8-
如果你正在學習 React 或是考慮將它加入到現有的專案,你可以透過[將 React 加入到網頁](/learn/add-react-to-a-website)快速的開始。如果你的專案將需要許多 component 以及檔案,是時候該考慮以下的選項了!
9-
10-
</Intro>
11-
12-
## 選擇你自己的冒險 {/*choose-your-own-adventure*/}
13-
14-
React 是一個 library,讓你透過將 UI 程式碼分解成各個稱為 component 來組織你的 UI。React 不在意你的 routing 或是 data management。對於這些功能,你將需要使用 third-party library 或是撰寫你自己的解決方案。意思是你有許多種方式可以開始一個新的 React 專案:
15-
16-
***僅使用工具鏈的最小設置開始**,根據專案需求來增加功能。
17-
* 從一個已經內建通用功能的 **opinionated 框架**開始。
18-
19-
無論你是剛開始使用 React,還是想要建立一些大專案,或者想要設定你自己的工具鏈,這份指南將會指引你走向正確的途徑。
20-
21-
## 開始使用 React 的工具鏈 {/*getting-started-with-a-react-toolchain*/}
22-
23-
如果你是剛開始使用 React,我們推薦 [Create React App](https://create-react-app.dev/),是最流行嘗試 React 功能的方式,也是建立一個新的 single-page、client-side application 的好方式。Create React App 是一個專門為 React 設置的 unopinionated 工具鏈。工具鏈有助於解決以下問題:
24-
25-
* 擴展到許多檔案以及 component
26-
* 從 npm 使用 third-party library
27-
* 提早發現常見錯誤
28-
* 在開發中即時的編輯 CSS 以及 JS
29-
* 針對 production 進行最佳化的輸出
30-
31-
你可以在 terminal 中使用一行指令來開始建構 Create React App!(**請確認你已經安裝了 [Node.js](https://nodejs.org/)**)
32-
=======
33-
If you're starting a new project, we recommend to use a toolchain or a framework. These tools provide a comfortable development environment but require a local Node.js installation.
7+
如果你正要開始一個新專案,我們推薦使用 toolchain 或是 framework。這些工具提供一個舒適的開發環境,但是本機端需要安裝 Node.js。
348

359
</Intro>
3610

3711
<YouWillLearn>
3812

39-
* How toolchains are different from frameworks
40-
* How to start a project with a minimal toolchain
41-
* How to start a project with a fully-featured framework
42-
* What's inside popular toolchains and frameworks
13+
* How toolchains are different from frameworks Toolchain 和 framework 有什麼差異
14+
* How to start a project with a minimal toolchain 如何從最小的 toolchain 開始一個新專案
15+
* How to start a project with a fully-featured framework 如何從功能完整的 framework 開始一個新專案
16+
* What's inside popular toolchains and frameworks 流行的 toolchain 和 framework 內有些什麼
4317

4418
</YouWillLearn>
4519

46-
## Choose your own adventure {/*choose-your-own-adventure*/}
20+
## 選擇你自己的冒險 {/*choose-your-own-adventure*/}
4721

48-
React is a library that lets you organize UI code by breaking it apart into pieces called components. React doesn't take care of routing or data management. This means there are several ways to start a new React project:
22+
React 是一個 library,讓你透過將 UI 程式碼分解成各個稱為 component 來組織你的 UI。React 不在意你的 routing 或是 data management。對於這些功能,你將需要使用 third-party library 或是撰寫你自己的解決方案。意思是你有許多種方式可以開始一個新的 React 專案:
4923

50-
* [Start with an **HTML file and a script tag**.](/learn/add-react-to-a-website) This doesn't require Node.js setup but offers limited features.
51-
* Start with a **minimal toolchain,** adding more features to your project as you go. (Great for learning!)
52-
* Start with an **opinionated framework** that has common features like data fetching and routing built-in.
24+
* [**HTML 文件和 script tag 開始**](/learn/add-react-to-a-website) 這不需要設定 Node.js,但提供的功能有限。
25+
* **使用 toolchain 的最小設置開始**,根據專案需求來增加功能。(非常適合的學習!)
26+
* 從一個 **opinionated 框架** 開始,它內建有 data fetching 和 routeing 等常見功能。
5327

54-
## Getting started with a minimal toolchain {/*getting-started-with-a-minimal-toolchain*/}
28+
## 從一個最小的 toolchain 開始 {/*getting-started-with-a-minimal-toolchain*/}
5529

56-
If you're **learning React,** we recommend [Create React App](https://create-react-app.dev/). It is the most popular way to try out React and build a new single-page, client-side application. It's made for React but isn't opinionated about routing or data fetching.
30+
如果你是剛開始使用 React,我們推薦 [Create React App](https://create-react-app.dev/)。它是最流行嘗試 React 功能的方式,也是建立一個新的 single-pageclient-side application 的好方式。它是為 React 設計的,但對 routing data fetching 不是 opinionated 的。
5731

58-
First, install [Node.js](https://nodejs.org/en/). Then open your terminal and run this line to create a project:
59-
>>>>>>> 26a870e1c6e232062b760d37620d85802750e985
32+
首先,安裝 [Node.js](https://nodejs.org/en/)。接著打開你的 terminal 並且執行這行來建立一個專案:
6033

6134
<TerminalBlock>
6235

@@ -75,69 +48,35 @@ npm start
7548

7649
更多資訊,[請參考官方指南](https://create-react-app.dev/docs/getting-started)
7750

78-
<<<<<<< HEAD
79-
> Create React App 並不處理後端或是資料庫的邏輯;它只建立了一個前端的建構管道。意思是你可以搭配任何的後端使用。如果你正在尋找更多像是 routing 和 server-side 邏輯的功能,請繼續閱讀下去!
80-
81-
### 其他選項 {/*other-options*/}
51+
> Create React App 並不處理後端或是資料庫的邏輯。你可以將它與任何 backend 一起使用。當你建立一個專案時,你會有一個資料夾與一些靜態的 HTML、CSS 和 JS。因為 Create React App 不能利用 server,所以它不能提供最好的效能。如果你追求更快的載入時間以及內建像是 routing 或 server-side logic,我們建議您使用框架。
8252
83-
Create React App 對於開始使用 React 是很棒的,但如果你想要一個更輕量的工具鏈,你可以嘗試其他流行的工具鏈:
84-
=======
85-
> Create React App doesn't handle backend logic or databases. You can use it with any backend. When you build a project, you'll get a folder with static HTML, CSS and JS. Because Create React App can't take advantage of the server, it doesn't provide the best performance. If you're looking for faster loading times and built-in features like routing and server-side logic, we recommend using a framework instead.
86-
87-
### Popular alternatives {/*popular-alternatives*/}
88-
>>>>>>> 26a870e1c6e232062b760d37620d85802750e985
53+
### 熱門替代選項 {/*popular-alternatives*/}
8954

9055
* [Vite](https://vitejs.dev/guide/)
9156
* [Parcel](https://parceljs.org/)
9257

93-
<<<<<<< HEAD
94-
## 使用 React 和一個框架進行建構 {/*building-with-react-and-a-framework*/}
95-
96-
如果你想要開始一個龐大、production-ready 的專案,[Next.js](https://nextjs.org/) 是一個很好的起點。Next.js 是一個用 React 建構靜態和伺服器渲染應用程式的流行、輕量級的框架。它預設包含了 routing、styling,以及 server-side rendering 等功能,讓你的可以專案快速的啟動和執行。
97-
98-
[開始使用 Next.js 建構](https://nextjs.org/docs/getting-started)的官方指南。
58+
## 用一個功能齊全的 framework 來建構 {/*building-with-a-full-featured-framework*/}
9959

100-
### 其他選項 {/*other-options-1*/}
60+
如果你想要**開始一個 production-ready 的專案**[Next.js](https://nextjs.org/) 是一個很好的起點。Next.js 是一個用 React 建構靜態和伺服器渲染應用程式的流行、輕量級的框架。它預設包含了 routing、styling,以及 server-side rendering 等功能,讓你的可以專案快速的啟動和執行。
10161

102-
* [Gatsby](https://www.gatsbyjs.org/) 讓你用 React 和 GraphQL 來產生靜態網站。
103-
* [Razzle](https://razzlejs.org/) 是一個不需要任何設置的 server-rendering 框架,但是比 Next.js 提供更多彈性。
104-
=======
105-
## Building with a full-featured framework {/*building-with-a-full-featured-framework*/}
62+
[Next.js Foundations](https://nextjs.org/learn/foundations/about-nextjs) 教學很好的介紹使用 React 和 Next.js 來進行構建。
10663

107-
If you're looking to **start a production-ready project,** [Next.js](https://nextjs.org/) is a great place to start. Next.js is a popular, lightweight framework for static and server‑rendered applications built with React. It comes pre-packaged with features like routing, styling, and server-side rendering, getting your project up and running quickly.
108-
109-
The [Next.js Foundations](https://nextjs.org/learn/foundations/about-nextjs) tutorial is a great introduction to building with React and Next.js.
110-
111-
### Popular alternatives {/*popular-alternatives*/}
64+
### 熱門替代選項 {/*popular-alternatives*/}
11265

11366
* [Gatsby](https://www.gatsbyjs.org/)
11467
* [Remix](https://remix.run/)
11568
* [Razzle](https://razzlejs.org/)
116-
>>>>>>> 26a870e1c6e232062b760d37620d85802750e985
117-
118-
## 客製化工具鏈 {/*custom-toolchains*/}
119-
120-
<<<<<<< HEAD
121-
你可能更喜歡建立和設置你自己的工具鏈。JavaScript 建構工具鏈通常由以下部分所組成:
122-
123-
* 一個 **package manager** — 讓你可以安裝、升級以及管理 third-party package。[Yarn](https://yarnpkg.com/)[npm](https://www.npmjs.com/) 是兩個最流行的 package manager。
124-
* 一個 **bundler** — 讓你可以撰寫模組化的程式,並將這些模組化程式 bundle 成更小的 package 來最佳化載入時間。[Webpack](https://webpack.js.org/)[Snowpack](https://www.snowpack.dev/)[Parcel](https://parceljs.org/) 是一些流行的 bundler。
125-
* 一個 **compiler** — 讓你可以撰寫現代化的 JavaScript 程式且仍然可以在舊的瀏覽器執行。[Babel](https://babeljs.io/) 就是一個這樣的例子。
126-
127-
在大型專案中,你可能也希望有工具可以在單一個 repository 內管理多個 package。[Nx](https://nx.dev/react) 就是這一種工具的例子。
12869

129-
如果你傾向從頭設置你自己的 JavaScript 工具鏈,請[查看本指南](https://blog.usejournal.com/creating-a-react-app-from-scratch-f3c693b84658)它重新建立了一些 Create React App 的功能。
130-
=======
131-
You may prefer to create and configure your own toolchain. A toolchain typically consists of:
70+
## 客製化 Toolchain {/*custom-toolchains*/}
13271

133-
* A **package manager** lets you install, update, and manage third-party packages. Popular package managers: [npm](https://www.npmjs.com/) (built into Node.js), [Yarn](https://yarnpkg.com/), [pnpm](https://pnpm.io/).
134-
* A **compiler** lets you compile modern language features and additional syntax like JSX or type annotations for the browsers. Popular compilers: [Babel](https://babeljs.io/), [TypeScript](http://typescript.org/), [swc](https://swc.rs/).
135-
* A **bundler** lets you write modular code and bundle it together into small packages to optimize load time. Popular bundlers: [webpack](https://webpack.js.org/), [Parcel](https://parceljs.org/), [esbuild](https://esbuild.github.io/), [swc](https://swc.rs/).
136-
* A **minifier** makes your code more compact so that it loads faster. Popular minifiers: [Terser](https://terser.org/), [swc](https://swc.rs/).
137-
* A **server** handles server requests so that you can render components to HTML. Popular servers: [Express](https://expressjs.com/).
138-
* A **linter** checks your code for common mistakes. Popular linters: [ESLint](https://eslint.org/).
139-
* A **test runner** lets you run tests against your code. Popular test runners: [Jest](https://jestjs.io/).
72+
你可能更喜歡建立和設置你自己的 toolchain。Toolchain 通常包括:
14073

141-
If you prefer to set up your own JavaScript toolchain from scratch, [check out this guide](https://blog.usejournal.com/creating-a-react-app-from-scratch-f3c693b84658) that re-creates some of the Create React App functionality. A framework will usually also provide a routing and a data fetching solution. In a larger project, you might also want to manage multiple packages in a single repository with a tool like [Nx](https://nx.dev/react).
74+
* 一個 **package manager** 讓你可以安裝、升級以及管理 third-party package。熱門的 package managers:[npm](https://www.npmjs.com/)(Node.js 內建)、[Yarn](https://yarnpkg.com/)[pnpm](https://pnpm.io/)
75+
* 一個 **compiler** 讓你編譯現代語法功能以及像是 JSX 或 type annotation 的額外語法給瀏覽器。熱門的 compilers:[Babel](https://babeljs.io/)[TypeScript](http://typescript.org/)[swc](https://swc.rs/)
76+
* 一個 **bundler** 讓你可以撰寫模組化的程式,並將這些模組化程式 bundle 成更小的 package 來最佳化載入時間。熱門的 bundlers: [webpack](https://webpack.js.org/)[Parcel](https://parceljs.org/)[esbuild](https://esbuild.github.io/)[swc](https://swc.rs/)
77+
* 一個 **minifier** 讓你的程式碼更 compact 讓載入速度更快。熱門的 minifiers:[Terser](https://terser.org/), [swc](https://swc.rs/)
78+
* 一個 **server** 處理 server 請求,所以你可以 render component 成 HTML。熱門的:[Express](https://expressjs.com/)
79+
* 一個 **linter** 檢查你的程式碼是否存在常見錯誤。熱門的 linters:[ESLint](https://eslint.org/)
80+
* 一個 **test runner** 讓你針對你的程式碼進行測試。熱門的 test runners:[Jest](https://jestjs.io/)
14281

143-
>>>>>>> 26a870e1c6e232062b760d37620d85802750e985
82+
如果你傾向從頭設置你自己的 JavaScript toolchain,請[查看本指南](https://blog.usejournal.com/creating-a-react-app-from-scratch-f3c693b84658)它重新建立了一些 Create React App 的功能。Framework 通常還會提供 routing 和 data fetching 解決方案。在大型專案中,你可能還會想使用像是 [Nx](https://nx.dev/react) 在一個 repository 來管理多的 package。

0 commit comments

Comments
 (0)