Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redux-thunk의 리턴값은 typescipt는 아직 dispatch를 원하고 있다... #2

Closed
yjkwon07 opened this issue Apr 17, 2021 · 0 comments
Labels
solution 솔루션 해결 type 타입 지정 문제

Comments

@yjkwon07
Copy link
Owner

Issue.

  • thunk의 action 함수 리턴은 Promise가 될 수 있다. 참고
  • 헬퍼 함수를 만드는 도중 thunk 모델링으로 saga의 로직을 Promise로 위임하여 컴포넌트에 try-catch문으로 saga 상태 관리를 할 수 있게 만들었다.
  • 하지만, 컴포넌트 로직에서는 await을 쓰는 순간 비동기 처리후 리턴되는 값을 모르고, (dispatch) => Promise 값으로 알고 있다.

image

image

  • 여기서 dispatach를 인자로 전달 하게 되면 나중에 다른 thunk에서는 처리를 못하는 상황이 또 오기 때문에 정확한 방법이 아니라고 판단한다.

Sol.

image

@yjkwon07 yjkwon07 added the type 타입 지정 문제 label Apr 17, 2021
@yjkwon07 yjkwon07 added the solution 솔루션 해결 label Jun 5, 2021
@yjkwon07 yjkwon07 closed this as completed Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution 솔루션 해결 type 타입 지정 문제
Projects
None yet
Development

No branches or pull requests

1 participant