【发布时间】:2021-12-06 03:37:23
【问题描述】:
谁能帮我摆脱这个警告
React Hook useEffect 缺少一个依赖项:'dispatch'。要么包含它,要么移除依赖数组 react-hooks/exhaustive-deps
这是我的代码
function Register(props) { const inusers=useSelector( (state) => {return state}); const history=useHistory() const dispatch=useDispatch(); // const formik = useFormikContext(); useEffect( () => { dispatch(fetchUser()) },[])
【问题讨论】:
标签: reactjs react-hooks