react16.8.6前端請求,打開頁面就要調用接口,獲取數(shù)據(jù),于是用useEffect調用接口,但是這樣接口會被不停的調用,那么代碼該怎么寫?useEffect(()=>{axios.get('/getYearMonth').then(res=>{console.log('getYearMonth',res);setValues(oldValues=>({...oldValues,fileList:res.data.msg}));})},[values]);
react 16.8.6 前端請求,用useEffect調用接口,但是這樣接口會被不停的調用,那么代碼該怎么寫?跪求!
慕妹3242003
2019-07-14 22:09:44