使用Reactive16.8.6(在以前的16.8.3版本中很好),当我试图阻止获取请求上的无限循环时,我会得到这个错误:Line 51: React Hook useEffect has a missing dependency: 'fetchBusinessesEither include it or remove the dependency array react-hooks
以下代码工作得很好:
const [ form, setForm然而,在我的控制台中,我看到编译器抱怨这个消息Line 20:6: React Hook useEffect has a missing dependency: 'form'.Either include it or remove the dependency array
我通过useAxios钩子使用React API钩子来获取组件加载时的useEffect数据。Either include them or remove the dependency array react-hooks/exhaustive-deps//eslint-disable-line react-hooks/exhaustive-deps
但我觉得这么做是不对的!我可以毫无问题地将常量添加到依赖项列表