原文:調用hook組件時報錯Hooks can only be called inside of the body of a function component

在調用其他項目中的hook組件時,報錯信息:無效的鈎子調用。鈎子只能在函數組件的主體內部調用。這可能是由於以下原因之一: A庫調用B,B使用的是npm link調試,會導致react的依賴出現兩次,所以需要在B中link到A下面的react,重啟項目 ...

2021-06-28 16:42 0 1581 推薦指數:

查看詳情

Error: Finish can only be called once

Android studio 啟動或者新建項目:報錯“Error: Finish can only be called once” gradle緩存問題: 默認的額緩存路徑在: on windows : C:\Users\YourUserName) 1、退出studio 2、進入緩存 ...

Thu Jul 27 21:48:00 CST 2017 0 1240
關於Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component

關於react中切換路由時報以上錯誤,實際的原因是因為在組件掛載(mounted)之后進行了異步操作,比如ajax請求或者設置了定時器等,而你在callback中進行了setState操作。當你切換路由時,組件已經被卸載(unmounted)了,此時異步操作中callback還在執行 ...

Thu Dec 07 20:59:00 CST 2017 0 12727
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM