📜  为什么我们应该只在顶层调用 Hooks - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:49.893000             🧑  作者: Mango

代码示例1
So this is why hooks must always be called at the top level of a component. It's the only way React can be sure that each hook will be called in exactly the same order each time the component is rendered. The best way to enforce this rule is to install the ESLint plugin