TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The Perils of Rehydration – A Realization about Gatsby and React

75 点作者 joshwcomeau大约 5 年前

6 条评论

ehnto大约 5 年前
Ignore React and all the community specific acronyms, you&#x27;re talking about a very fundamental problem that is technology agnostic and it&#x27;s important to understand it from that perspective, so you can take this knowledge with you to any tool.<p>Whenever you try to precompile or even just cache an HTML file that relies on run time data, you are going to have to build your application in a way that is sympathetic to that. In most cases, you&#x27;re going to have to figure out how to fetch the missing data on the client side and populate it into the template&#x2F;runtime context.<p>This is an issue in Ruby, PHP, Javascript, React, Angular, Python... every single application with caching or compilation.
评论 #22473228 未加载
评论 #22473461 未加载
dgb23大约 5 年前
I don’t quite understand why this pattern would be necessary. I would prefer to render a ‚loading‘ state for dynamic components at build time, hydration sees a valid state and the user gets a clear indication of what is going on. Am I missing something?
评论 #22474749 未加载
评论 #22473761 未加载
评论 #22473993 未加载
pixelbreaker大约 5 年前
This is a really useful post and explains the two-pass render paradigm really well for me. Will be implementing in my work for sure.
nielsbot大约 5 年前
I&#x27;ve hit this same issue myself when using Gatsby... Thanks for the clear and informative post describing the cause AND providing a solution.
ThePhysicist大约 5 年前
Interesting post, the fadeout effect on the top (in the mobile view) really bothers me for some reason though.
_bxg1大约 5 年前
At some point one just has to step back and question how necessary all of this complexity is. This &quot;best of both worlds&quot; hybrid approach adds so many hidden moving parts. I also don&#x27;t really see why it&#x27;s needed; the twin paradigms of &quot;lightweight web page&quot; and &quot;heavyweight web app&quot; really seem like they neatly cover the vast majority of cases.