https://github.com/jeffbski/redux-logic
https://github.com/redux-saga/redux-saga
https://github.com/BerkeleyTrue/redux-epic
Is there anybody who tried any of this with server side rendering like in this COOLEST repository ?
@newasmod Thanks for raising this as a point of discussion.
I took a stab at reading it a while ago, but did not go further than that. I have not actually found myself using the above in production in personal projects or at work.
Does anyone have an example of a good use case of handling side-effects or asynchronous tasks that needs to be handled with redux? I love redux, however am very cautious. I obviously have not read enough around this topic, but it does seem to me that state management can be kept simple with redux if we keep IO/async stuff outside of it.
The example of redux-saga - with i believe is the most commonly used - is quite good to show what it does.
To "convert" it to this project, if we look at createTopic function then it performs several things:
Basically, what redux saga says is (from my understanding) write your actions/action creators in a usual sync way and let all the async stuff be handled by redux-saga middleware. Meaning it should make the actions that you fire of your components more simple.
So in the above example, the createTopic would only fire a simple CREATE_TOPIC action, and redux-saga will listen to this action and do the other logic of steps 2,3.
From my understanding, this is somewhat similar to the promiseMiddleware that this project used to have.
I've started using redux-observable and am in love with it! Here is a comparison vs redux-saga: https://hackmd.io/s/H1xLHUQ8e syntactically i just think redux-observable is simpler for me to read. My use case for wanting to implement was essentially making an async/ ajax version of the tasks where typing will automatically save to the database after every keystroke (with debounce).
Also check out the Netflix presentation half way down their docs page if you haven't seen it already.
EDIT
Perhaps this falls into the scenario of un-necessary use since thunk can accomplish the same thing i think?
So i've done a little bit more reading into the different options and this is what i think and understood from them
redux-thunk - Simple wrapper for the dispatch function that allows you to do async actions. When complex actions start to show up, might be more difficult to do and implement.
redux-saga - pretty much explained earlier. Basically there is something on the side that "listens" to specific events and then performs different things according to that action. One think that i like less about this is the usage of generators. Its another thing that you need to know in order to use it (Not always as simple as Promises)
redux-loop - didnt like it at all. Its going for the ELM architecture flow causing the redux reducers to be build differently than redux originally intended.
redux-observable - very similar to redux-saga, basically does the same thing. Uses Observers to handle the async actions. Did not really like the fact that you pretty much need to learn RxJS for this.
redux-epic (mentioned earlier) - will soon be deprecated and there is a recommendation to move to redux-observable (its the same architecture and usage of RxJS)
I believe the main comparison should be: thunk, saga, observable. I think those 3 are the biggest ones.
For me, i tend towards redux-saga. I am already familiar with generators and the syntax and writing seems more natural to me (i dont know RxJS at all so maybe that's also why)
What do you think?
Most helpful comment
So i've done a little bit more reading into the different options and this is what i think and understood from them
redux-thunk - Simple wrapper for the dispatch function that allows you to do async actions. When complex actions start to show up, might be more difficult to do and implement.
redux-saga - pretty much explained earlier. Basically there is something on the side that "listens" to specific events and then performs different things according to that action. One think that i like less about this is the usage of generators. Its another thing that you need to know in order to use it (Not always as simple as Promises)
redux-loop - didnt like it at all. Its going for the ELM architecture flow causing the redux reducers to be build differently than redux originally intended.
redux-observable - very similar to redux-saga, basically does the same thing. Uses Observers to handle the async actions. Did not really like the fact that you pretty much need to learn RxJS for this.
redux-epic (mentioned earlier) - will soon be deprecated and there is a recommendation to move to redux-observable (its the same architecture and usage of RxJS)
I believe the main comparison should be: thunk, saga, observable. I think those 3 are the biggest ones.
For me, i tend towards redux-saga. I am already familiar with generators and the syntax and writing seems more natural to me (i dont know RxJS at all so maybe that's also why)
What do you think?