原因是因为我的代码中有一个无效的钩子调用错误,而且我相信这是因为我有不匹配的反应。我在无效的钩子调用页面上运行了重复的react测试,得到了false,这意味着我有两个反应。在使用"npm“之后,我看到了以下错误:在peerDependencies下的node_ under /redux表单中,我有:
"react</
这在某种程度上是一个关于React Hooks的深入问题: 有一些writing about, the setState() returned from React Hook useState(),当我们调用它时然而,如果这是真的,如果我们颠倒子组件1和2的顺序,如果count 0是奇数或偶数,那么一切都应该正常工作,并且the React Hooks doc does not say we can't do
我已经面对了使用react的Invariant violation: rendered fewer hooks than expected问题。从其他答案来看,显然不应该有条件地调用钩子()。我决定安装eslint-plugin-react-hooks以防止将来出现类似的情况。现在它用React Hook "useState" is called conditionally.React Hooks must be called in the exact same order in ev