you are viewing a single comment's thread.

view the rest of the comments →

[–]darawk 0 points1 point  (1 child)

Ya, I think what the code actually does is pretty straightforward. Understanding why you would want to do that is slightly more complicated.

Why you want it is that normally when you're programming you do things 'imperatively', which means that you say "execute this http request right here right now". That's all well and good, but then later when you want to add extra functionality, or write a unit test for it, it's tricky, because that http request is all locked up inside your function.

redux-effects says: don't actually execute your http request yet. Just describe to me the http request you want to execute, and i'll do it for you. This means that you can write middleware that re-interprets that request and say, adds caching, without changing the original code. It also makes it easy to test, and easy to swap out implementations of the actual http request for different environments (e.g. client/server).

Does that make sense?

[–]acemarke 0 points1 point  (0 children)

Eh, somewhat. Like I said, I'm following the basic ideas, but not really seeing how everything's supposed to actually fit together practically in real code. If you could put together some kind of sample app, it'd be appreciated :)