Setting the record straight on hydration
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 11.8k
- 派生
- 7.9k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 11
描述
Anything I google related to react and hydration has the following blog post come up written by a prominent Google employee: https://addyosmani.com/blog/rehydration/
It shows the DOM being entirely destroyed and recreated as pictured below. The hydrate docs are a bit unclear about what exactly happens during hydration. They start out by saying that hydrate "is used to hydrate a container", but never explicitly define hydration. And so we must rely on blogs such as the one linked above to explain what hydration in more detail. After hours of digging through inaccurate information I'm pretty sure the above blog is terribly misleading.
If I'm right that Addy's image is incorrect, perhaps someone from Facebook could use their network to reach out and get this image corrected to reflect that the DOM is not destroyed? Otherwise, it would be helpful for React to have its own docs that explain hydration in more depth. The docs describe to some degree what happens during hydration, but not exactly why and leave a lot of ambiguity. E.g. why does hydration "patch up differences in text content" and why would such differences exist in the first place?

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先阅读链接的 React hydrate 文档和所引用的 hydration 文章,然后比较它们对 DOM 重用和文本不匹配的描述。更新 React 文档,明确地定义 hydration、解释其用途,并说明文本内容差异的原因;修订后的指南应解决此处提出的歧义。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100