-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
感觉ahooks可以把信号量整合进来,类似于@preact/signal中的几个方法 #2221
Comments
你是希望 preact 的 signal, signal.peek, computed, effect, batch 这些 hook 都整合进来?还是只整合某几个 hook?但是我看除了 useSignal 在 react 中都有与之对应的 hook 了呀。 想要使用与 useSignal 相同能力的 hook,可以使用 ahooks 的 useReactive,用法一致的。 有其他更好的整合进来的建议吗?感觉和 react 原生提供的 hook 能力都重复了 @1075488066 |
Hi, 1075488066. It seems that this issue is a bit vague and lacks some necessary information. 看起来这条 issue 描述得有些模糊,缺少一些必要的信息。 |
主要是希望在写watch功能时不用自己手动添加依赖。 |
这个能力要寄希望于 react 官方来实现了,ahooks 作为一个 hook 库,实现不了 另外,把 useEffect 当成 watch 来用,不是特别好的 react 编码实践,不太推荐。 可以参考官方的文档:You Might Not Need an Effect 把滥用 useEffect 的地方优化掉,然后你会发现,自己几乎不会再被什么 watch 不 watch 的心智负担所缠绕。 |
@preact/signal
signal
The text was updated successfully, but these errors were encountered: