且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 React Hooks 时出现 UseState 错误

更新时间:2022-12-13 08:14:29

钩子规则 lint 规则使用命名约定来推断函数的用途.以 use 开头的函数被假定为钩子.以大写字母开头的函数被假定为组件.contact 两者都不是.将其更改为 Contact.

The rules-of-hooks lint rule uses naming conventions to infer what functions are for. Functions starting with use are assumed to be hooks. Functions starting with a capital letter are assumed to be components. contact is neither. Change it to Contact.