diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000..0de500150a
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,10 @@
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/.github/ISSUE_TEMPLATE/0-bug.yml b/.github/ISSUE_TEMPLATE/0-bug.yml
deleted file mode 100644
index 56d2e8540f..0000000000
--- a/.github/ISSUE_TEMPLATE/0-bug.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-name: "🐛 Report a bug"
-description: "Report a problem on the website."
-title: "[Bug]: "
-labels: ["bug: unconfirmed"]
-body:
- - type: textarea
- attributes:
- label: Summary
- description: |
- A clear and concise summary of what the bug is.
- placeholder: |
- Example bug report:
- When I click the "Submit" button on "Feedback", nothing happens.
- validations:
- required: true
- - type: input
- attributes:
- label: Page
- description: |
- What page(s) did you encounter this bug on?
- placeholder: |
- https://react.dev/
- validations:
- required: true
- - type: textarea
- attributes:
- label: Details
- description: |
- Please provide any additional details about the bug.
- placeholder: |
- Example details:
- The "Submit" button is unresponsive. I've tried refreshing the page and using a different browser, but the issue persists.
- validations:
- required: false
diff --git a/.github/ISSUE_TEMPLATE/1-typo.yml b/.github/ISSUE_TEMPLATE/1-typo.yml
deleted file mode 100644
index c86557a116..0000000000
--- a/.github/ISSUE_TEMPLATE/1-typo.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-name: "🤦 Typo or mistake"
-description: "Report a typo or mistake in the docs."
-title: "[Typo]: "
-labels: ["type: typos"]
-body:
- - type: textarea
- attributes:
- label: Summary
- description: |
- A clear and concise summary of what the mistake is.
- placeholder: |
- Example:
- The code example on the "useReducer" page includes an unused variable `nextId`.
- validations:
- required: true
- - type: input
- attributes:
- label: Page
- description: |
- What page is the typo on?
- placeholder: |
- https://react.dev/
- validations:
- required: true
- - type: textarea
- attributes:
- label: Details
- description: |
- Please provide a explanation for why this is a mistake.
- placeholder: |
- Example mistake:
- In the "useReducer" section of the "API Reference" page, the code example under "Writing a reducer function" includes an unused variable `nextId` that should be removed.
- validations:
- required: false
diff --git a/.github/ISSUE_TEMPLATE/2-suggestion.yml b/.github/ISSUE_TEMPLATE/2-suggestion.yml
deleted file mode 100644
index ac0b480fe9..0000000000
--- a/.github/ISSUE_TEMPLATE/2-suggestion.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-name: "💡 Suggestions"
-description: "Suggest a new page, section, or edit for an existing page."
-title: "[Suggestion]: "
-labels: ["type: documentation"]
-body:
- - type: textarea
- attributes:
- label: Summary
- description: |
- A clear and concise summary of what we should add.
- placeholder: |
- Example:
- Add a new page for how to use React with TypeScript.
- validations:
- required: true
- - type: input
- attributes:
- label: Page
- description: |
- What page is this about?
- placeholder: |
- https://react.dev/
- validations:
- required: false
- - type: textarea
- attributes:
- label: Details
- description: |
- Please provide a explanation for what you're suggesting.
- placeholder: |
- Example:
- I think it would be helpful to have a page that explains how to use React with TypeScript. This could include a basic example of a component written in TypeScript, and a link to the TypeScript documentation.
- validations:
- required: true
diff --git a/.github/ISSUE_TEMPLATE/3-framework.yml b/.github/ISSUE_TEMPLATE/3-framework.yml
deleted file mode 100644
index a47295e1e8..0000000000
--- a/.github/ISSUE_TEMPLATE/3-framework.yml
+++ /dev/null
@@ -1,116 +0,0 @@
-name: "📄 Suggest new framework"
-description: "I am a framework author applying to be included as a recommended framework."
-title: "[Framework]: "
-labels: ["type: framework"]
-body:
- - type: markdown
- attributes:
- value: |
- ## Apply to be included as a recommended React framework
-
- _This form is for framework authors to apply to be included as a recommended [React framework](https://react.dev/learn/start-a-new-react-project). If you are not a framework author, please contact the authors before submitting._
-
- Our goal when recommending a framework is to start developers with a React project that solves common problems like code splitting, data fetching, routing, and HTML generation without any extra work later. We believe this will allow users to get started quickly with React, and scale their app to production.
-
- While we understand that many frameworks may want to be featured, this page is not a place to advertise every possible React framework or all frameworks that you can add React to. There are many great frameworks that offer support for React that are not listed in our guides. The frameworks we recommend have invested significantly in the React ecosystem, and collaborated with the React team to be compatible with our [full-stack React architecture vision](https://react.dev/learn/start-a-new-react-project#which-features-make-up-the-react-teams-full-stack-architecture-vision).
-
- To be included, frameworks must meet the following criteria:
-
- - **Free & open-source**: must be open source and free to use.
- - **Well maintained**. must be actively maintained, providing bug fixes and improvements.
- - **Active community**: must have a sufficiently large and active community to support users.
- - **Clear onboarding**: must have clear install steps to install the React version of the framework.
- - **Ecosystem compatibility**: must support using the full range of libraries and tools in the React ecosystem.
- - **Self-hosting option**: must support an option to self-host applications without losing access to features.
- - **Developer experience**. must allow developers to be productive by supporting features like Fast Refresh.
- - **User experience**. must provide built-in support for common problems like routing and data-fetching.
- - **Compatible with our future vision for React**. React evolves over time, and frameworks that do not align with React’s direction risk isolating their users from the main React ecosystem over time. To be included on this page we must feel confident that the framework is setting its users up for success with React over time.
-
- Please note, we have reviewed most of the popular frameworks available today, so it is unlikely we have not considered your framework already. But if you think we missed something, please complete the application below.
- - type: input
- attributes:
- label: Name
- description: |
- What is the name of your framework?
- validations:
- required: true
- - type: input
- attributes:
- label: Homepage
- description: |
- What is the URL of your homepage?
- validations:
- required: true
- - type: input
- attributes:
- label: Install instructions
- description: |
- What is the URL of your getting started guide?
- validations:
- required: true
- - type: dropdown
- attributes:
- label: Is your framework open source?
- description: |
- We only recommend free and open source frameworks.
- options:
- - 'No'
- - 'Yes'
- validations:
- required: true
- - type: textarea
- attributes:
- label: Well maintained
- description: |
- Please describe how your framework is actively maintained. Include recent releases, bug fixes, and improvements as examples.
- validations:
- required: true
- - type: textarea
- attributes:
- label: Active community
- description: |
- Please describe your community. Include the size of your community, and links to community resources.
- validations:
- required: true
- - type: textarea
- attributes:
- label: Clear onboarding
- description: |
- Please describe how a user can install your framework with React. Include links to any relevant documentation.
- validations:
- required: true
- - type: textarea
- attributes:
- label: Ecosystem compatibility
- description: |
- Please describe any limitations your framework has with the React ecosystem. Include any libraries or tools that are not compatible with your framework.
- validations:
- required: true
- - type: textarea
- attributes:
- label: Self-hosting option
- description: |
- Please describe how your framework supports self-hosting. Include any limitations to features when self-hosting. Also include whether you require a server to deploy your framework.
- validations:
- required: true
- - type: textarea
- attributes:
- label: Developer Experience
- description: |
- Please describe how your framework provides a great developer experience. Include any limitations to React features like React DevTools, Chrome DevTools, and Fast Refresh.
- validations:
- required: true
- - type: textarea
- attributes:
- label: User Experience
- description: |
- Please describe how your framework helps developers create high quality user experiences by solving common use-cases. Include specifics for how your framework offers built-in support for code-splitting, routing, HTML generation, and data-fetching in a way that avoids client/server waterfalls by default. Include details on how you offer features such as SSG and SSR.
- validations:
- required: true
- - type: textarea
- attributes:
- label: Compatible with our future vision for React
- description: |
- Please describe how your framework aligns with our future vision for React. Include how your framework will evolve with React over time, and your plans to support future React features like React Server Components.
- validations:
- required: true
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
deleted file mode 100644
index 63e310e0ba..0000000000
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-contact_links:
- - name: 📃 Bugs in React
- url: https://github.com/facebook/react/issues/new/choose
- about: This issue tracker is not for bugs in React. Please file React issues here.
- - name: 🤔 Questions and Help
- url: https://reactjs.org/community/support.html
- about: This issue tracker is not for support questions. Please refer to the React community's help and discussion forums.
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
deleted file mode 100644
index 7e4f6d2f2c..0000000000
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml
index 83e7f2e8a9..8c46d96771 100644
--- a/.github/workflows/analyze.yml
+++ b/.github/workflows/analyze.yml
@@ -58,7 +58,7 @@ jobs:
- name: Download base branch bundle stats
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
- if: success() && github.event.number
+ if: success()
with:
workflow: analyze.yml
branch: ${{ github.event.pull_request.base.ref }}
diff --git a/README.md b/README.md
index 182192cb55..ecd588894a 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,15 @@
+# [React 中文文档](https://zh-hans.react.dev/)
+
+此仓库包含 [React 中文文档](https://zh-hans.react.dev/) 的文档及源码,并由官方实时同步。
+
+## 参与贡献
+
+目前,大部分的翻译工作都已经完成。现在主要工作是同步和完善已有翻译。
+
+**参与贡献前,请仔细阅读 [React 中文文档译文规范](https://github.com/reactjs/zh-hans.react.dev/wiki/React-Translation-Guide)**。
+
+---
+
# react.dev
This repo contains the source code and documentation powering [react.dev](https://react.dev/).
diff --git a/TRANSLATION.md b/TRANSLATION.md
new file mode 100644
index 0000000000..c07b511f91
--- /dev/null
+++ b/TRANSLATION.md
@@ -0,0 +1,66 @@
+# React 中文文档翻译指南
+
+下面我们会从 [翻译注意事项](#翻译注意事项) 以及 [翻译流程](#翻译流程) 两个方面开始介绍。
+
+关于翻译的问题和反馈,请移步至 [这个讨论](https://github.com/reactjs/zh-hans.react.dev/discussions/1089)。
+
+如果你有除了翻译内容以外的贡献,请移步到 [英文文档仓库](https://github.com/reactjs/react.dev/tree/main/README.md)。
+
+## 翻译注意事项
+
+- 在翻译的过程中,我们需要遵循 [React 中文文档译文规范](https://github.com/reactjs/zh-hans.react.dev/wiki/React-Translation-Guide)。
+- 对于翻译中的专有名词,参见 [术语表](https://github.com/reactjs/zh-hans.react.dev/issues/2)。
+
+## 翻译流程
+
+1. 阅读 [翻译注意事项](#翻译注意事项)
+
+~~2. 挑选你想要翻译的文章并进行 [任务认领](https://github.com/reactjs/zh-hans.react.dev/issues/602)~~ (**目前翻译工作大多数已经完成,无需在这里认领,请留意新提出的 issue,在那里进行认领**)
+
+3. 你可能需要设置一些必要的开发环境,参见 [前提准备](#前提准备)
+4. 准备就绪,你就可以进行 [翻译工作](#开始翻译),翻译工作包括切换分支、内容修改和代码测试
+5. 需要将你的改变提交到 GitHub 并创建 Pull Request,参见 [提交和推送](#提交和推送)
+6. 审查人员会审核你的 Pull Request,当两人以上通过该 Pull Request 时,你的翻译将被合并到仓库中
+
+注:在以前,我们还有一份更为详细的 [翻译流程说明](https://github.com/reactjs/zh-hans.react.dev/issues/603),可以供你参考
+
+### 前提准备
+
+- Git
+- Node:任意从 12.x 开始或者更高的版本
+- Yarn:参见 [Yarn 网站上的安装说明](https://yarnpkg.com/lang/en/docs/install/)
+- fork 该仓库(无论是什么样的贡献,都需要该操作)
+- clone 这个仓库到本地:`git clone my-fork-name`
+
+#### 安装相关依赖
+
+1. 进入该项目的根目录
+2. `yarn`:下载网站需要的 npm 依赖
+
+#### 在本地运行
+
+1. `yarn dev`:运行开发服务器(由 [Next.js](https://nextjs.org/) 支持)
+2. `open http://localhost:3000`:用你最爱的浏览器打开这个网站
+
+### 开始翻译
+
+#### 切换分支
+
+1. `git checkout main`:你可以在仓库中的任意文件夹运行这段命令,它会切换到 main 分支
+2. `git pull origin main`:这将确保你的 main 分支保持最新
+3. `git checkout -b the-name-of-my-branch`:这将创建一个新的分支,并切换到该分支(使用合适的名称替换 `the-name-of-my-branch`)
+
+#### 审查你的改变
+
+> 在你为该项目做出贡献后,你可以先在本地审查你的贡献。
+
+1. 如果可以,请在桌面和移动设备上测试最新版本在常见浏览器中的任何视觉变化。
+2. 运行 `yarn check-all`。(这将运行 Prettier、ESLint 以及验证 TypeScript 的类型)。
+
+### 提交和推送
+
+1. `git add -A && git commit -m "My message"`:暂存以及提交你的改变(使用其它提交信息替换 `My message`,例如 `Fix header logo on Android`)
+2. `git push -u my-fork-name the-name-of-my-branch`
+3. 进入 [zh-hans.react.dev 仓库](https://github.com/reactjs/zh-hans.react.dev),你将看到你最新 push 的分支。
+4. 跟随 [GitHub 的指南](https://docs.github.com/zh/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request?tool=webui) 创建 Pull Request。
+5. 在你完成以上步骤之后,该仓库会触发预构建,此时你可以查看你的改变是否符合预期。
diff --git a/src/components/Layout/Feedback.tsx b/src/components/Layout/Feedback.tsx
index fe92725170..76ee294dc7 100644
--- a/src/components/Layout/Feedback.tsx
+++ b/src/components/Layout/Feedback.tsx
@@ -74,7 +74,7 @@ function SendFeedback({onSubmit}: {onSubmit: () => void}) {
{exit: isSubmitted}
)}>
- {isSubmitted ? 'Thank you for your feedback!' : 'Is this page useful?'}
+ {isSubmitted ? '谢谢你的反馈意见!' : '这个页面对你有帮助吗?'}