I gather that the useEffect
Hook is run after every render, if provided with an empty dependency array:
useEffect(() => {
performSideEffect();
}, []);
But what's the difference between that, and the following?
useEffect(() => {
performSideEffect();
});
Notice the lack of []
at the end. The linter plugin doesn't throw a warning.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…