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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: What do you think about React Hooks?

9 点作者 lsm超过 6 年前
Link here: https://reactjs.org/docs/hooks-intro.html

2 条评论

salvoravida超过 6 年前
My 2c on the hooks cause: <a href="https:&#x2F;&#x2F;github.com&#x2F;salvoravida&#x2F;react-class-hooks" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;salvoravida&#x2F;react-class-hooks</a><p>Use Custom Hooks with React Class Components. Compatible React &gt;= 16.0.0
dreamdu5t超过 6 年前
At first glance, hooks are hard to reason about. They encourage changing pure functions into stateful functions that return different results depending on when they were called.<p>Immediately after seeing the first example, I&#x27;m left wondering what happens if I called useState(0) twice? Does it produce references to the same state object or two separate ones? Does it throw an error? I see &quot;count&quot; and &quot;setCount&quot; being destructured, but where are they defined? Through static analysis during a special build step, through getters, or what?
评论 #18314425 未加载