Loading...
Loading...
Compare original and translation side by side
useStatestartTransition<Suspense>useStatestartTransition<Suspense>| Type | Tone | Example |
|---|---|---|
| Learn | Conversational | "Here's what that looks like...", "You might be wondering..." |
| Reference | Technical | "Call |
| Blog | Accurate | Focus on facts, not marketing |
| 类型 | 语气 | 示例 |
|---|---|---|
| 学习类 | 口语化、通俗易懂 | "下面是具体示例..."、"你可能会疑惑..." |
| 参考类 | 技术严谨 | "在顶层调用 |
| 博客类 | 准确客观 | 聚焦事实,避免营销话术 |
| Jargon | Plain Language |
|---|---|
| atomic | all-or-nothing, batched together |
| idempotent | same inputs, same output |
| deterministic | predictable, same result every time |
| memoize | remember the result, skip recalculating |
| referentially transparent | (avoid - describe the behavior) |
| invariant | rule that must always be true |
| reify | (avoid - describe what's being created) |
| Concept | Analogy |
|---|---|
| Components/React | Kitchen (components as cooks, React as waiter) |
| Render phases | Restaurant ordering (trigger/render/commit) |
| State batching | Waiter collecting full order before going to kitchen |
| State behavior | Snapshot/photograph in time |
| State storage | React storing state "on a shelf" |
| State purpose | Component's memory |
| Pure functions | Recipes (same ingredients → same dish) |
| Pure functions | Math formulas (y = 2x) |
| Props | Adjustable "knobs" |
| Children prop | "Hole" to be filled by parent |
| Keys | File names in a folder |
| Curly braces in JSX | "Window into JavaScript" |
| Declarative UI | Taxi driver (destination, not turn-by-turn) |
| Imperative UI | Turn-by-turn navigation |
| State structure | Database normalization |
| Refs | "Secret pocket" React doesn't track |
| Effects/Refs | "Escape hatch" from React |
| Context | CSS inheritance / "Teleportation" |
| Custom Hooks | Design system |
| 行话 | 通俗表述 |
|---|---|
| atomic | 全有或全无,批量处理 |
| idempotent | 相同输入得到相同输出 |
| deterministic | 可预测,每次结果一致 |
| memoize | 记住结果,跳过重复计算 |
| referentially transparent | (避免使用 - 直接描述行为) |
| invariant | 必须始终遵守的规则 |
| reify | (避免使用 - 直接描述创建的内容) |
| 概念 | 类比 |
|---|---|
| 组件/React | 厨房(组件是厨师,React是服务员) |
| 渲染阶段 | 餐厅点餐流程(触发/渲染/提交) |
| 状态批处理 | 服务员收集完整订单后再去厨房 |
| 状态行为 | 某一时刻的快照/照片 |
| 状态存储 | React将状态"放在架子上" |
| 状态用途 | 组件的记忆 |
| 纯函数 | 菜谱(相同食材→相同菜品) |
| 纯函数 | 数学公式(y = 2x) |
| Props | 可调节的"旋钮" |
| Children prop | 父组件预留的"空位" |
| Keys | 文件夹中的文件名 |
| JSX中的大括号 | "通往JavaScript的窗口" |
| 声明式UI | 出租车司机(只需告知目的地,无需指挥每一步) |
| 命令式UI | 逐向导航 |
| 状态结构 | 数据库规范化 |
| Refs | React不追踪的"秘密口袋" |
| Effects/Refs | 脱离React控制的"逃生舱" |
| Context | CSS继承 / "传送" |
| 自定义Hooks | 设计系统 |
\`\`\`js
// 🚩 Don't mutate state:
obj.x = 10;
\`\`\`
\`\`\`js
// ✅ Replace with new object:
setObj({ ...obj, x: 10 });
\`\`\`| passing a function | calling a function |
| `onClick={handleClick}` | `onClick={handleClick()}` |[Read about state](/learn/state-a-components-memory)
[See `useState` reference](/reference/react/useState)\`\`\`js
// 🚩 请勿直接修改state:
obj.x = 10;
\`\`\`
\`\`\`js
// ✅ 替换为新对象:
setObj({ ...obj, x: 10 });
\`\`\`| 传递函数 | 调用函数 |
| `onClick={handleClick}` | `onClick={handleClick()}` |[了解state相关内容](/learn/state-a-components-memory)
[查看`useState`参考文档](/reference/react/useState)thisthisStarting in React 19, render `<Context>` as a provider:
\`\`\`js
<SomeContext value={value}>{children}</SomeContext>
\`\`\`
In older versions:
\`\`\`js
<SomeContext.Provider value={value}>{children}</SomeContext.Provider>
\`\`\`从React 19开始,直接渲染`<Context>`作为提供者:
\`\`\`js
<SomeContext value={value}>{children}</SomeContext>
\`\`\`
在旧版本中:
\`\`\`js
<SomeContext.Provider value={value}>{children}</SomeContext.Provider>
\`\`\`