Skip to content

Commit

Permalink
合并
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenmang committed Jun 28, 2023
2 parents 251b75d + 1e42ead commit af0a337
Show file tree
Hide file tree
Showing 77 changed files with 2,359 additions and 2,350 deletions.
206 changes: 103 additions & 103 deletions src/content/blog/2023/03/16/introducing-react-dev.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions src/content/blog/2023/05/03/react-canaries.md

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions src/content/blog/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,72 @@ title: React Blog

<Intro>

This blog is the official source for the updates from the React team. Anything important, including release notes or deprecation notices, will be posted here first. You can also follow the [@reactjs](https://twitter.com/reactjs) account on Twitter, but you won’t miss anything essential if you only read this blog.
这个博客是 React 团队更新的官方来源。任何重要的内容,包括发布说明或弃用通知,都会首先在这里发布。你也可以关注 Twitter 的 [@reactjs](https://twitter.com/reactjs) 账号,但如果你只阅读这个博客,你也不会错过任何重要的内容。

</Intro>

<div className="sm:-mx-5 flex flex-col gap-5 mt-12">

<BlogCard title="React Canaries: Incremental Feature Rollout Outside Meta" date="May 3, 2023" url="/blog/2023/05/03/react-canaries">
<BlogCard title="React Canaries:在 Meta 之外逐步推出新功能" date="2023 年 5 月 3 日" url="/blog/2023/05/03/react-canaries">

Traditionally, new React features used to only be available at Meta first, and land in the open source releases later. We'd like to offer the React community an option to adopt individual new features as soon as their design is close to final--similar to how Meta uses React internally. We are introducing a new officially supported Canary release channel. It lets curated setups like frameworks decouple adoption of individual React features from the React release schedule.
在过去,React 的新功能将仅在 Meta 中使用,然后才会在开源版本中发布。我们希望为 React 社区提供一种选择,使他们能够在新功能设计接近最终状态时立即采用这些功能——类似于 Meta 内部使用 React 的方式。我们正在推出一个新的官方支持的 Canary 发布渠道。它允许像框架这样的精选设置,对单个 React 功能的采用与 React 发布计划分离开。

</BlogCard>

<BlogCard title="React Labs: What We've Been Working On – March 2023" date="March 22, 2023" url="/blog/2023/03/22/react-labs-what-we-have-been-working-on-march-2023">
<BlogCard title="React Labs:我们正在努力的方向——2023 年 3 月" date="2023 年 3 月 22 日" url="/blog/2023/03/22/react-labs-what-we-have-been-working-on-march-2023">

In React Labs posts, we write about projects in active research and development. Since our last update, we've made significant progress on React Server Components, Asset Loading, Optimizing Compiler, Offscreen Rendering, and Transition Tracing, and we'd like to share what we learned.
React Labs 的文章中,我们讲述了正在进行研究和开发的项目。自上次更新以来,我们在 React 服务器组件、资产加载、优化编译器、离屏渲染和过渡追踪方面取得了重要进展,并希望分享我们所学到的知识。

</BlogCard>


<BlogCard title="Introducing react.dev" date="March 16, 2023" url="/blog/2023/03/16/introducing-react-dev">
<BlogCard title="介绍 react.dev" date="2023 年 3 月 16 日" url="/blog/2023/03/16/introducing-react-dev">

Today we are thrilled to launch react.dev, the new home for React and its documentation. In this post, we would like to give you a tour of the new site.
今天,我们非常高兴推出 react.devReact 及其文档的新家。在本文中,我们想带你参观新网站。

</BlogCard>


<BlogCard title="React Labs: What We've Been Working On – June 2022" date="June 15, 2022" url="/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022">
React 18 was years in the making, and with it brought valuable lessons for the React team. Its release was the result of many years of research and exploring many paths. Some of those paths were successful; many more were dead-ends that led to new insights. One lesson we’ve learned is that it’s frustrating for the community to wait for new features without having insight into these paths that we’re exploring...
<BlogCard title="React Labs:我们正在努力的方向——2022 年 6 月" date="2022 年 6 月 15 日" url="/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022">
React 18 经过多年的努力才得以问世,它为 React 团队带来了宝贵的经验教训。它的发布是多年的研究和探索的结果。其中一些路径是成功的,但更多的是死胡同,但是也带来了新的见解。我们学到的一个教训是,对社区来说,在等待新功能时没有了解我们正在探索的路径是令人沮丧的。
</BlogCard>

<BlogCard title="React v18.0" date="March 29, 2022" url="/blog/2022/03/29/react-v18">
React 18 is now available on npm! In our last post, we shared step-by-step instructions for upgrading your app to React 18. In this post, we’ll give an overview of what’s new in React 18, and what it means for the future...
<BlogCard title="React v18.0" date="2022 年 3 月 29 日" url="/blog/2022/03/29/react-v18">
React 18 现已在 npm 上发布!在我们上一篇文章中,我们分享了应用程序升级到 React 18 的逐步说明。在本文中,我们将概述 React 18 的新功能,以及它对未来的意义……
</BlogCard>

<BlogCard title="How to Upgrade to React 18" date="March 8, 2022" url="/blog/2022/03/08/react-18-upgrade-guide">
As we shared in the release post, React 18 introduces features powered by our new concurrent renderer, with a gradual adoption strategy for existing applications. In this post, we will guide you through the steps for upgrading to React 18...
<BlogCard title="如何升级到 React 18" date="2022 年 3 月 8 日" url="/blog/2022/03/08/react-18-upgrade-guide">
正如我们在文章中所分享的那样,React 18 引入了由我们的新并发渲染器提供支持的功能,并采用了逐步采用策略,以适用于现有应用程序。在本文中,我们将指导完成升级到 React 18 的步骤……
</BlogCard>

<BlogCard title="React Conf 2021 Recap" date="December 17, 2021" url="/blog/2021/12/17/react-conf-2021-recap">
Last week we hosted our 6th React Conf. In previous years, we’ve used the React Conf stage to deliver industry changing announcements such as React Native and React Hooks. This year, we shared our multi-platform vision for React, starting with the release of React 18 and gradual adoption of concurrent features...
<BlogCard title="回顾 React Conf 2021" date="2021 年 12 月 17 日" url="/blog/2021/12/17/react-conf-2021-recap">
上周,我们举办了第六届 React Conf。在以往的几年中,我们在 React Conf 的舞台上发布了行业改变的信息,如 React Native React Hooks。今年,我们从发布 React 18 和逐步采用并发功能开始,分享了我们对 React 的多平台愿景……
</BlogCard>

<BlogCard title="The Plan for React 18" date="June 8, 2021" url="/blog/2021/06/08/the-plan-for-react-18">
The React team is excited to share a few updates:
<BlogCard title="React 18 的有关计划" date="2021 年 6 月 8 日" url="/blog/2021/06/08/the-plan-for-react-18">
React 团队很高兴分享一些更新:

- We’ve started work on the React 18 release, which will be our next major version.
- We’ve created a Working Group to prepare the community for gradual adoption of new features in React 18.
- We’ve published a React 18 Alpha so that library authors can try it and provide feedback...
- 我们已经开始了 React 18 的开发工作,这将是我们的下一个主要版本。
- 我们创建了一个工作组,为社区逐步采用 React 18 的新功能做准备。
- 我们发布了 React 18 Alpha,以便库作者可以尝试并提供反馈……
</BlogCard>

<BlogCard title="Introducing Zero-Bundle-Size React Server Components" date="December 21, 2020" url="/blog/2020/12/21/data-fetching-with-react-server-components">
2020 has been a long year. As it comes to an end we wanted to share a special Holiday Update on our research into zero-bundle-size React Server Components. To introduce React Server Components, we have prepared a talk and a demo. If you want, you can check them out during the holidays, or later when work picks back up in the new year...
<BlogCard title="介绍零打包大小的 React 服务器组件" date="2020 年 12 月 21 日" url="/blog/2020/12/21/data-fetching-with-react-server-components">
2020 年是漫长的一年。随着它的结束,我们想在节日里分享一份特别的更新,介绍我们对零打包大小的 React 服务器组件的研究。为了介绍 React 服务器组件,我们准备了一次演讲和演示。如果你愿意,在假期期间或新年工作重新开始后查看它们……
</BlogCard>

</div>

---

### All release notes {/*all-release-notes*/}
### 所有的发布笔记 {/*all-release-notes*/}

Not every React release deserves its own blog post, but you can find a detailed changelog for every release in the [`CHANGELOG.md`](https://github.com/facebook/react/blob/main/CHANGELOG.md) file in the React repository, as well as on the [Releases](https://github.com/facebook/react/releases) page.
并不是每个 React 版本都值得拥有专属博客文章,但是你可以在 React 仓库的 `CHANGELOG.md`[发布页面](https://github.com/facebook/react/releases) 中找到每个版本的详细变更。

---

### Older posts {/*older-posts*/}
### 更早的文章 {/*older-posts*/}

See the [older posts.](https://reactjs.org/blog/all.html)
你可以在 [这里](https://reactjs.org/blog/all.html) 查看更早的文章。

<div className="h-12"></div>
2 changes: 1 addition & 1 deletion src/content/community/conferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ August 18 in Guangzhou, China

[Website](https://react.w3ctech.com)

### React Rally 2018{/*react-rally-2018*/}
### React Rally 2018 {/*react-rally-2018*/}
August 16-17 in Salt Lake City, Utah USA

[Website](http://www.reactrally.com) - [Twitter](https://twitter.com/reactrally)
Expand Down
2 changes: 1 addition & 1 deletion src/content/learn/choosing-the-state-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ translators:
4. **避免重复的 state**。当同一数据在多个 state 变量之间或在多个嵌套对象中重复时,这会很难保持它们同步。应尽可能减少重复。
5. **避免深度嵌套的 state**。深度分层的 state 更新起来不是很方便。如果可能的话,最好以扁平化方式构建 state。

这些原则背后的目标是 **使 state 易于更新而不引入错误**。从 state 中删除冗余和重复数据有助于确保所有部分保持同步。这类似于数据库工程师想要 [“规范化”数据库结构](https://docs.microsoft.com/en-us/office/troubleshoot/access/database-normalization-description),以减少出现错误的机会。用爱因斯坦的话说,**“让你的状态尽可能简单,但不要过于简单。”**
这些原则背后的目标是 **使 state 易于更新而不引入错误**。从 state 中删除冗余和重复数据有助于确保所有部分保持同步。这类似于数据库工程师想要 [“规范化”数据库结构](https://docs.microsoft.com/zh-CN/office/troubleshoot/access/database-normalization-description),以减少出现错误的机会。用爱因斯坦的话说,**“让你的状态尽可能简单,但不要过于简单。”**

现在让我们来看看这些原则在实际中是如何应用的。

Expand Down
6 changes: 3 additions & 3 deletions src/content/learn/conditional-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function PackingList() {

需要注意的是,有些 `Item` 组件的 `isPacked` 属性是被设为 `true` 而不是 `false`。你可以在那些满足 `isPacked={true}` 条件的物品旁加上一个勾选符号(✔)。

你可以用 [if/else 语句](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else) 去判断:
你可以用 [if/else 语句](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/if...else) 去判断:

```js
if (isPacked) {
Expand Down Expand Up @@ -312,7 +312,7 @@ export default function PackingList() {

</Sandpack>

[JavaScript && 表达式](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_AND) 的左侧(我们的条件)为 `true` 时,它则返回其右侧的值(在我们的例子里是勾选符号)。但条件的结果是 `false`,则整个表达式会变成 `false`。在 JSX 里,React 会将 `false` 视为一个“空值”,就像 `null` 或者 `undefined`,这样 React 就不会在这里进行任何渲染。
[JavaScript && 表达式](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Logical_AND) 的左侧(我们的条件)为 `true` 时,它则返回其右侧的值(在我们的例子里是勾选符号)。但条件的结果是 `false`,则整个表达式会变成 `false`。在 JSX 里,React 会将 `false` 视为一个“空值”,就像 `null` 或者 `undefined`,这样 React 就不会在这里进行任何渲染。


<Pitfall>
Expand All @@ -329,7 +329,7 @@ JavaScript 会自动将左侧的值转换成布尔类型以判断条件成立与

### 选择性地将 JSX 赋值给变量 {/*conditionally-assigning-jsx-to-a-variable*/}

当这些快捷方式妨碍写普通代码时,可以考虑使用 `if` 语句和变量。因为你可以使用 [`let`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let) 进行重复赋值,所以一开始你可以将你想展示的(这里指的是物品的名字)作为默认值赋予给该变量。
当这些快捷方式妨碍写普通代码时,可以考虑使用 `if` 语句和变量。因为你可以使用 [`let`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/let) 进行重复赋值,所以一开始你可以将你想展示的(这里指的是物品的名字)作为默认值赋予给该变量。

```js
let itemContent = name;
Expand Down
Loading

0 comments on commit af0a337

Please sign in to comment.