摘要: Hook 规则 Hook 是 React 16.8 的新增特性。它可以让你在不编写 class 的情况下使用 state 以及其他的 React 特性。 Hook 本质就是 JavaScript 函数,但是在使用它时需要遵循两条规则。我们提供了一个 linter 插件来强制执行这些规则: 只在最顶层 阅读全文
posted @ 2023-02-16 14:18 SimoonJia 阅读(44) 评论(0) 推荐(0)
摘要: https://zh-hans.reactjs.org/warnings/invalid-hook-call-warning.html 你能到这个页面很可能是因为你看到了以下错误信息: Hooks can only be called inside the body of a function co 阅读全文
posted @ 2023-02-16 11:37 SimoonJia 阅读(345) 评论(0) 推荐(0)