docs(cndocs): sync intro-react and network with upstream#1030
Conversation
- intro-react.md: major rewrite to match upstream restructuring - Remove class component tabs/examples (EN dropped them) - Remove redundant `import React from 'react'` from all examples - Update React URLs: reactjs.org → react.dev - jsx → tsx code fences - Add JS/TS SnackPlayer tabs (matching EN) - Update tab groupId/defaultValue to match EN conventions - network.md: minor sync - Fix axios URL: mzabriskie/axios → axios/axios - Remove extra jQuery warning text (EN removed it) - tsx → ts code fences to match EN
📝 WalkthroughWalkthroughThis PR updates Chinese React Native documentation guides to align with modern React patterns. The React introduction ( ChangesDocumentation Refresh: React Introduction and Networking Guides
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cndocs/intro-react.md`:
- Line 164: 文档中标题从 "##" 直接跳到 "#### 对开发者的提示" 导致层级跳跃(MD001),请将该行标题标记改为三级标题 "###
对开发者的提示"(替换现有的 "#### 对开发者的提示"),以修复标题层级一致性问题并通过 linter 校验。
- Line 315: 在包含文本 "按惯例来说,props 用来配置组件的第一次渲染(初始状态)。state 则用来记录组件中任意可能随时间变化的数据。"
的句子中,将片语 "按惯例来说" 替换为更流畅的表述,例如 "按惯例,props 用于..." 或 "按惯例,对于……来说,props
用于...",以改写为类似 "按惯例,props 用于配置组件的第一次渲染(初始状态)。state 则用来记录组件中任意可能随时间变化的数据。"
以提升可读性并保持原意。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8f4d05aa-2c20-4a11-bcc9-f29849a7bf57
📒 Files selected for processing (2)
cndocs/intro-react.mdcndocs/network.md
| export default Cat; | ||
| ``` | ||
|
|
||
| #### 对开发者的提示 |
There was a problem hiding this comment.
修复标题层级跳跃(Line 164)
当前从 ## 直接跳到 ####,会触发 MD001。建议将该标题改为 ### 对开发者的提示。
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 164-164: Heading levels should only increment by one level at a time
Expected: h3; Actual: h4
(MD001, heading-increment)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@cndocs/intro-react.md` at line 164, 文档中标题从 "##" 直接跳到 "#### 对开发者的提示"
导致层级跳跃(MD001),请将该行标题标记改为三级标题 "### 对开发者的提示"(替换现有的 "#### 对开发者的提示"),以修复标题层级一致性问题并通过
linter 校验。
|
|
||
| > 按惯例来说,props 用来配置组件的第一次渲染(初始状态)。state 则用来记录组件中任意可能随时间变化的数据。下面示例的情景发生在一个猫咪咖啡馆中,两只猫咪正嗷嗷待哺。它们的饥饿程度会随着时间变化(相对地,它们的名字就不会变化),因此会记录在状态中。示例中还有一个喂食按钮,一键干饭,扫除饥饿状态! | ||
| :::info | ||
| 按惯例来说,props 用来配置组件的第一次渲染(初始状态)。state 则用来记录组件中任意可能随时间变化的数据。 |
There was a problem hiding this comment.
优化语句搭配以提升可读性(Line 315)
“按惯例来说”建议改为“按惯例,对于……来说”或直接“按惯例,props 用于……”。
🧰 Tools
🪛 LanguageTool
[uncategorized] ~315-~315: 固定搭配: “来说” 应与 “对” 或 “对于” 搭配使用:对于...来说。
Context: ...随时间或者用户交互而变化的数据。状态使组件拥有了记忆! :::info 按惯例来说,props 用来配置组件的第一次渲染(初始状态)。state 则用来记录组件中...
(wb2)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@cndocs/intro-react.md` at line 315, 在包含文本 "按惯例来说,props
用来配置组件的第一次渲染(初始状态)。state 则用来记录组件中任意可能随时间变化的数据。" 的句子中,将片语 "按惯例来说" 替换为更流畅的表述,例如
"按惯例,props 用于..." 或 "按惯例,对于……来说,props 用于...",以改写为类似 "按惯例,props
用于配置组件的第一次渲染(初始状态)。state 则用来记录组件中任意可能随时间变化的数据。" 以提升可读性并保持原意。
翻译同步: intro-react + network
同步的翻译文件
cndocs/intro-react.md(主要重构):import React from 'react'reactjs.org→react.devjsx→tsx代码围栏cndocs/network.md(小修补):mzabriskie/axios→axios/axiostsx→ts代码围栏匹配 ENwebsite/ → cnwebsite/ 配置同步
本次上游合并仅涉及文档内容更新(
docs/、website/versioned_docs/),无package.json、docusaurus.config.ts等配置文件变更,无需同步 cnwebsite 配置。构建验证
yarn --cwd cnwebsite build✅ 通过(67s)Summary by CodeRabbit