I guess there is problem with your usefeect()
1.With no second param,
useEffect(()=>{})
it will call every time when the every component render.
2.With second parameter as []
useEffect(()=>{},[])
It will call only when the component will mount (first time)
3.Some arguments passed in the Second parameter
useEffect(()=>{},[arg])
It will call when the arguments value changes.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…