3 ms·
> I don't like redux and it's crazy indirection Can you explain this? There's very little indirection (if any) in Redux.
by abritinthebay 9y ago
> I don't like redux and it's crazy indirection
Can you explain this? There's very little indirection (if any) in Redux.
- acemarke 9y agoI'm a Redux maintainer, and both Dan Abramov and I would disagree. Describing behavior as plain object actions _is_ a form of indirection, compared to code that directly applies a state update. It's a tradeoff. Use of plain object actions takes some more code, but opens up the power of middleware and time travel debugging.
- abritinthebay 9y agoSurely that’s abstraction rather than indirection? Maybe you’re using it in a different context than I’m used to but I don’t see anything indirect about “call function that passes it’s result to another that updates the data”. Sure it’s not “update state directly” but that would make every pattern “indirect” which makes little sense. What you’re describing would make any MVP, pubsub, or observable system indirect. If so, well, fine - fair enough - but it still makes OPs complaint strange. (Thanks for all your work btw)
- acemarke 9y agoYeah, I'd agree that pubsub _is_ a form of indirection in and of itself. For comparison: state.counter += 1; vs store.dispatch({type : "INCREMENT_COUNTER"}); // counter slice reducer case "INCREMENT_COUNTER" : return state + 1; That's indirection, because we're no longer going in and modifying the state right there. So yes, any function call that encapsulates or abstracts behavior would be a small form of indirection, and the act of describing the event or desired update as an action rather than directly implementing it is definitely a form of indirection.
- abritinthebay 9y agoWell yes, ok, but as you said - that makes function calls technically indirection. So, as before, sure - that's fine, but it makes the original criticism a bit... strange.