Skip to content

Commit 50c3ab0

Browse files
Update src/content/reference/rules/react-calls-components-and-hooks.md
1 parent 6fb519d commit 50c3ab0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/content/reference/rules/react-calls-components-and-hooks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,4 @@ function useDataWithLogging() {
9898
```
9999

100100
这样,`<Button />` 组件更容易理解也更易于调试。当 Hook 以动态方式使用时,会大大增加应用的复杂性,并妨碍局部推理,这从长远来看会降低团队的生产力。它还更容易意外地违反 [Hook 的规则](/reference/rules/rules-of-hooks),即 Hook 不应该被条件性地调用。如果你发现自己需要为测试而模拟组件,最好是模拟服务器返回以响应预设数据。如果可能,通常进行端到端测试你的应用是更有效的方法。
101+

0 commit comments

Comments
 (0)