Hỏi & Đáp
dispatch를 사용하는 함수 안에 async await
1. axios.post 후에 then cath 붙이 된다는것은 사가나 thunk에서 사용하는 로직안을 뜻하는건가요? 2. 현 로직에 dispatch 대신 axios.post를 사용하면 된다는 뜻인가요? => 이렇게 사용하게 된다면 saga의 takelatest나 takeEvery같은 saga 헬퍼 기능은 쓰기 힘들어 지겠네요. const onSubmit = useCallback ( async () => { try { const response = await axios . post ( "/user" , { email , password , nickname }); message . success ( "회원가입에 성공하셨습니다." ). then (() => Router . push ( "/" ). then ()); } catch ( signupError ) { message . error ( JSON . stringify ( signupError , null , 4 )). then (); } }, []);
- Lượt thích
- 0
- Số bình luận
- 3
- Lượt xem
- 3060

