违背hooks原则 #74
Unanswered
mankeheaven
asked this question in
Q&A
Replies: 3 comments
-
https://observable-hooks.js.org/zh-cn/api/#useobservablestate |
Beta Was this translation helpful? Give feedback.
0 replies
-
get 还是代码设计,强制了只能使用其中一种,不能出现切换为另一种,否则就会出现问题,是说怎么违背了react hooks原则,还能跑通的。。。
|
Beta Was this translation helpful? Give feedback.
0 replies
-
通过这种参数来做事情,感觉始终不是一个明智之举,如果重新设计,可能还是分开多个api好,这个重载方式,跟react的hooks顺序问题,容易让人蒙蔽 因为我是在这个usexxx之前return,出现过bug的。所以对这个比较敏感 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hooks是依赖顺序的,以下代码应该会报错,至于为啥违反了react原则又没报错,这个很有水准
Beta Was this translation helpful? Give feedback.
All reactions