react useState 非同步 資料獲取不到

2021-10-07 14:27:10 字數 437 閱讀 4845

最近在專案中發現了乙個問題,就是非同步獲取的資料,在usestate第一次儲存的時候,會有儲存不上的時候,問了對接的某大廠的人,趾高氣昂充滿傲嬌的跟我說,沒辦法,誰讓咱們不會那,解決問題就行了,其他的也不重要

const [categtry, setcategtry] = usestate();

const [categdata, setcategdata] = usestate();

useeffect(() => , );

useeffect(() =>

}, [categtry]);

const getcollacategory = async () => = await call(service.getcollacategory);

if (resp.code === 0)

};

非同步 非同步任務

非同步任務 記錄一下學習完springboot後進行使用非同步方法時的筆記 service層 author yesijie date 2019 11 29 15 25 service public class asyncc catch interruptedexception e system.ou...

anroid之非同步不如非同步

executeonexecutor asynctask.thread pool executor 使用自定義的corepoolsize為7的executor executors.newfixedthreadpool 7 使用未設限制的executor executors.newcachedthrea...

非同步通知與非同步I O

非同步通知 很簡單,一旦裝置準備好,就主動通知應用程式,這種情況下應用程式就不需要查詢裝置狀態,這是不是特像硬體上常提的 中斷的概念 上邊比較準確的說法其實應該叫做 訊號驅動的非同步i o 訊號是在軟體層次上對中斷機制的一種模擬。阻塞 i o意味著一直等待裝置可訪問再訪問,非阻塞i o意味著使用po...