error:‘React Hook useEffect has a missing dependency:’

llfididi
  • 19

react报错
需要忽略这个警告吗?

src\page\home\deviceList\deviceList.jsx
  Line 94:6:  React Hook useEffect has a missing dependency: 'getgatewaydevice'. Either include it or remove the dependency array  react-hooks/exhaustive-deps

src\page\home\gatewayConfig\gatewayConfig.jsx
  Line 35:6:  React Hook useEffect has a missing dependency: 'props.history'. Either include it or remove the dependency array  react-hooks/exhaustive-deps


src\page\home\gatewayInfo\gatewayInfo.jsx
  Line 70:17:  Assignments to the 'setTime' variable from inside React Hook useEffect will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside useEffect  react-hooks/exhaustive-deps
  Line 80:6:   React Hook useEffect has a missing dependency: 'history'. Either include it or remove the dependency array                                                                                                                                                                                react-hooks/exhaustive-deps

src\page\home\gatewayInfo\upgrade\upgrade.tsx
  Line 27:6:  React Hook useEffect has a missing dependency: 'show'. Either include it or remove the dependency array  react-hooks/exhaustive-deps

src\page\home\home.jsx
  Line 89:5:  React Hook useEffect has a missing dependency: 'props'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
回复
阅读 761
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏