📜  错误:无效的挂钩调用.钩子只能在函数组件的主体内部调用. - 无论代码示例

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

代码示例1
You can only call hooks from React functions. Read more here.
(https://reactjs.org/docs/hooks-rules.html#only-call-hooks-from-react-functions)

Just convert the class component to a functional component.