如果不把otherValue1, otherValue2加入依賴數(shù)組的話,doSomething里面很可能會訪問到otherValue1, otherValue2舊的變量引用,從而發(fā)生意想不到的錯誤(如果安裝hooks相關(guān)eslint的話,會提示警告)。 反之,如果把otherValue1, otherValue2加入依賴數(shù)組的話,這兩個值改變的時候doSomething也會執(zhí)行,這并不是我們想要的(我們...
www.dbjr.com.cn/article/2124...htm 2025-5-15