-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
docs(cn): translate reference/react/use-client into Chinese #1248
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Size changes📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
awxiaoxian2020
requested changes
Jul 6, 2023
* 像 `<MarkdownRenderer>` 这样既不使用仅服务器功能也不仅使用客户端功能的组件通常不应标记为 `'use client'`。这样当在服务器组件中使用时,它们可以专门在服务器上渲染;但当在客户端组件中使用时,它们将被添加到客户端包中。 | ||
* 发布到 npm 的库应该在导出的 React 组件上包含 `'use client'`,这些组件可以使用仅使用客户端 React 功能的可序列化 props 进行渲染,以允许服务器组件导入和渲染这些组件。否则,用户将需要将库组件包装在自己的 `'use client'` 文件中,这可能很麻烦,并且会阻止库稍后将逻辑移动到服务器。将预捆绑文件发布到 npm 时,请确保 `'use client'` 源文件最终位于标有 `'use client'` 的捆绑包中,与包含可直接在服务器上使用的导出的任何捆绑包分开。 | ||
* 客户端组件仍将作为服务器渲染 (SSR) 或构建时(build-time)静态站点生成 (SSG) 的一部分运行,它们充当客户端,将 React 组件的初始渲染输出转换为可在下载 JavaScript 包之前渲染的 HTML。但他们无法使用仅服务器功能,例如直接从数据库读取数据。 | ||
* 像 `'use client'` 这样的指令必须位于文件的最开头,位于任何导入或其他代码之上(指令上方可以存在注释)。它们必须用单引号或双引号编写,而不是反引号。`'use-xyz'` 指令格式类似于 `'useXyz'` Hook 命名约定,但相似之处纯属巧合。 |
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.
Suggested change
* 像 `'use client'` 这样的指令必须位于文件的最开头,位于任何导入或其他代码之上(指令上方可以存在注释)。它们必须用单引号或双引号编写,而不是反引号。`'use-xyz'` 指令格式类似于 `'useXyz'` Hook 命名约定,但相似之处纯属巧合。 | |
* 像 `'use client'` 这样的指令必须位于文件的最开头,位于任何导入或其他代码之上(指令上方可以存在注释)。它们必须用单引号或双引号编写,而不是反引号。`'use xyz'` 指令格式类似于 `'useXyz'` Hook 命名约定,但相似之处纯属巧合。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
翻译 reference/react/use-client。