Readit News logoReadit News
papapopper commented on Async friendly transformation middleware for Redux   github.com/contrarian/red... · Posted by u/papapopper
molszanski · 8 years ago
The docs is in TS. I am not used to reading and understanding fancy TS. This is a problem.
papapopper · 8 years ago
Noted. I may add seperate JS documentation.
papapopper commented on Async friendly transformation middleware for Redux   github.com/contrarian/red... · Posted by u/papapopper
davnicwil · 8 years ago
What's the advantage of using this over:

1) transforming actions directly inside action creators 2) transforming responses inside redux-thunk thunks or redux-promise-middleware promises

Maybe I'm not getting it, but with the above methods I can already transform my actions and responses. I can also use async/await if I want to mix async and sync logic in a readable way. This just seems to layer an abstraction over that sort of thing, but for what benefit? Is this actually intended to be an alternative to redux-thunk or redux-promise-middleware, and not used in conjunction with them?

Genuinely asking for information and not trying to be critical, sometimes it's hard to see use cases and benefits of new patterns when you first encounter them :-)

papapopper · 8 years ago
redux-transform: 1. lets you transform an arbitrary number of fields with an arbitrary number of transformations 2. runs the transformers for each field concurrently

It is true that there are other opportunities to transform actions, but you would have to implement the logic to perform arbitrary transformations. You can use async/await to mix async and sync logic, but you will have to be careful about concurrency. With redux-transform, you can just focus on implementing transformers, and specifying which ones to perform.

redux-transform is intended to complement other middleware. You can use it in conjunction with both redux-thunk and redux-promise.

papapopper commented on Async friendly transformation middleware for Redux   github.com/contrarian/red... · Posted by u/papapopper
acemarke · 8 years ago
Looks useful. Still not used to reading TypeScript, but I get the general idea and implementation.

I'll definitely add this to my Redux addons catalog in the next update!

papapopper · 8 years ago
papapopper commented on Async friendly transformation middleware for Redux   github.com/contrarian/red... · Posted by u/papapopper
papapopper · 8 years ago
redux-transform is a general transformation middleware.

You can use it to transform an API response. But more intriguingly you can use APIs to transform an action.

u/papapopper

KarmaCake day12August 16, 2016View Original