📜  react usestate set is async - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:58.727000             🧑  作者: Mango

代码示例1
setMovies(result);
console.log(movies) // movies here will not be updated

// you sould handle it inside here
useEffect(() => {
    // action on update of movies
}, [movies]);