-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
精读《React Hooks》 #111
Comments
这个 |
@totoSalad 不会,判断了 chart 实例是否存在。 |
在我的理解里 function component 没有实例,每次组件更新时 chart 都是 null,需要新建。有在线demo吗? |
@totoSalad 你可以挂到ref上面每次的ref都会是同一个实例。 |
@crimx 感谢建议!空数组是最好的,我例子中的方式很容易被其它组件的更新刷新掉。文中我修改一下。 |
场景如果是整个生命周期只渲染一次,@crimx 的方案没有问题~ |
只渲染一次的话, |
|
|
enzymejs/enzyme#2176 (comment) |
@Tan90Qian 包括 hooks 的 devTools 也才支持,生态上确实需要等待完善。 |
`{(count, setCount) => }; function App(props) { |
这个判断chart就是一种状态吧,不应该写在UI组件中吧? |
本周精读的文章是:making-sense-of-react-hooks,国内也有比较好的分析文章,比如 对React Hooks的一些思考。
The text was updated successfully, but these errors were encountered: