Redux: Official example with Redux Saga

Created on 4 Feb 2016  路  8Comments  路  Source: reduxjs/redux

I don鈥檛 have any candidates but I鈥檇 love to see an official example demonstrating use cases where Redux Saga shines. Since I haven鈥檛 written apps in a while, I don鈥檛 really know what scenarios people enjoy using it for, so ideas are welcome!

cc @yelouafi

discussion ecosystem examples

Most helpful comment

@gaearon as we already discussed about that with @yelouafi I've used sagas to manage user onboardings (user doing real actions, not a stupid carousel).

I'm planning at some point to show how easy it could be to plug an onboarding to an existing app (ie TodoMVC) with redux-saga but I first need to define a spec for that onboarding :) I'd also like to provide an implementation using thunks so that people can compare, and maybe a challenge so that others could make an attempt in other technologies as well (like CycleJs or Elm...).

I've just created a repo for that so maybe you have ideas for the spec? https://github.com/slorber/todomvc-onboarding

All 8 comments

I lack the necessary imagination :) but here are some ideas

  • Authorization flow: login -> refresh each x secs -> logout using token based authorization
  • Infinite Scroll on a filtrable view: each filter change cancels ongoing scrolling (and pending request) and starts a new one
  • Interactively Guided tutorial like this one (angular)

Another example I wanted to try is some SVG drawing app : for example a mouse click may have multiple interpretations depending on various params (current drawing tool, current step in a multi-step drawing like polyline, bezier path ... )

@gaearon as we already discussed about that with @yelouafi I've used sagas to manage user onboardings (user doing real actions, not a stupid carousel).

I'm planning at some point to show how easy it could be to plug an onboarding to an existing app (ie TodoMVC) with redux-saga but I first need to define a spec for that onboarding :) I'd also like to provide an implementation using thunks so that people can compare, and maybe a challenge so that others could make an attempt in other technologies as well (like CycleJs or Elm...).

I've just created a repo for that so maybe you have ideas for the spec? https://github.com/slorber/todomvc-onboarding

Onboarding is an amazing use case!

@slorber a challenge, yea I'm up for that!
I was looking at redux saga this weekend and while i was initially impressed in the unit testing, until I got to the docs where the author struggled with concurrency. I'd say that's the limitation with redux saga---the generators map asynchronous events to synchronous events, so then you struggle when you need the asynchronicity to be explicit. Was able to reimplement the same functionality using streams and handle lots of more edge cases (that's what FRP is for).

Yea @slorber, I've looked at saga-rxjs before. Elm may be too much for me.
What I didn't like about saga-rxjs is that it doesn't give you the same API as redux-saga.
I've created my own version of redux-saga (same functionality in 40 lines of code thanks to KefirJS):

https://github.com/awesome-editor/awesome-editor/blob/saga/src/app/Saga.js

With an FRP library under the hood, you have none of the asynchronous issues I described above.

Not sure what's the problem you have with the saga-rxjs project. Yes it's not the same API but do you feel like there are things you can't do with it?

This is pretty much covered via http://redux.js.org/docs/faq/Miscellaneous.html#miscellaneous-real-projects , which points to my list of selected Redux examples and actual applications at https://github.com/markerikson/redux-ecosystem-links/blob/master/apps-and-examples.md . Going to close this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amorphius picture amorphius  路  3Comments

vraa picture vraa  路  3Comments

ilearnio picture ilearnio  路  3Comments

vslinko picture vslinko  路  3Comments

CellOcean picture CellOcean  路  3Comments