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

Convert from redux-thunk to redux-saga #314

Closed
justin808 opened this issue Aug 10, 2016 · 7 comments
Closed

Convert from redux-thunk to redux-saga #314

justin808 opened this issue Aug 10, 2016 · 7 comments

Comments

@justin808
Copy link
Member

justin808 commented Aug 10, 2016

I'm looking for opinions here.

At team ShakaCode, we're using redux-saga rather than redux-thunk for new projects.

Options:

  1. Move existing code to redux-saga, and keep a non-router version of the code using redux-thunk. Basically, one more tab.
  2. Switch all the code to redux-saga.

References:

@justin808
Copy link
Member Author

Check out this tutorial I made: https://forum.shakacode.com/t/experimenting-with-generators/657

@justin808
Copy link
Member Author

As of right now, Thunk is easier to understand and debug. See #315. We should probably make a new project with thunk.

That being said, it's a great exercise to convert the 2 simple async calls to thunk in a PR.

@dzirtusss
Copy link
Contributor

I'll look at this issue

@justin808
Copy link
Member Author

See #325

@yangmillstheory
Copy link

Just curious, do you all find the conceptual overhead of redux-saga worth it?

I've used Thunks extensively in a production application, and have had no issues or complaints.

In terms of testability, it still seems like you have to manipulate generator internals, which seems like a leaky abstraction.

With Thunks, it seems like it would be possible to mock out XHR via Jest which would seem more straightforward.

I've also heard from less experienced members on my team that sagas were tough to debug and not as straightforward to use as Thunks.


Again, I don't have direct experience with sagas, just looking for an opinion from someone that's used both.

@justin808
Copy link
Member Author

@yangmillstheory You should be able to mock either the saga or thunk with jest. In terms of debugging, yes, the chrome debugger is not good inside of the generator function. You have to use print statements. I think they are both good ways.

@justin808
Copy link
Member Author

This one should have gotten merged. Any takers that want to create an updated PR with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants