4 ms·
Redux is like 200 lines of code and very explicit without any magic. What exactly is complex about it? I think too often people don't appreciate that redux, li
by Waterluvian 10y ago
Redux is like 200 lines of code and very explicit without any magic. What exactly is complex about it?
I think too often people don't appreciate that redux, like all frameworks is a trade-off and is often the wrong tool for the job. Speaking about it as if it's a generic framework to trade out for another framework is a sign that it's being selected for the wrong reasons.
If it's not making your life easier, you probably shouldn't be using it for that application. It's a really nice framing hammer, not a multitool ;)
When I got into front end, I used redux for a small SPA with about a dozen actions and didn't really get it. "I could do this with react and basic JavaScript. Why am I writing so much extra?" I refactored redux out and it was much better.
I have another application that interfaces with a number of APIs, is a very thick client and needs to recover from local storage on startup. Redux fit like a glove!
- cnp 10y agoI think a lot of the complexity comes from the incredible specificity of the docs. The authors intend to _teach_, which while great (thank you) it can seem overly complex for users who first land there. I think a "Quick Start" section would solve a lot of the so-called "complexity" issues, showcasing a few common use-cases: - Without React - With React Put bare-bones code under each of those sections and then let the user learn the particulars as they come (and as their projects demand)
- jaredsohn 10y agoWithout Redux - With Redux
- deleted 10y ago[deleted]
- deleted 10y ago[deleted]
- acemarke 10y agoI'm currently the primary maintainer doing stuff with Redux docs. Right now my focus is on a tutorial series I'm writing for my own blog, but any PRs to help improve the Redux docs are absolutely appreciated!
- cnp 10y agoWill give it a look tomorrow :thumbsup:
- 010a 10y agoI would argue that implementing it, especially in situations where you need to create a new reducer, requires a huge amount of boilerplate for something that feels like it shouldn't. Considering 75% of what you use redux for is getting and setting simple variables, I don't know why actions and reducers have to be so copy-pasty. The core idea of Flux, and the theory behind Redux, is very simple. But I personally dislike Redux.
- Waterluvian 10y agoThe boilerplate is very intentional. If you want a framework that reduces boilerplate by doing some magic or having a more strict interface, then yeah absolutely, Redux isn't the right choice for you.
- true_religion 10y agoIt is being compared to mobx. I am not sure how observables are magical.
- atoko 10y agoHave you read the source? It's far heavier than redux. Computed properties and observables that can potentially change other observables sounds like a recipe for spaghetti IMO. @observer seems like the same thing as connect(), but it passes down the entire state as context. ¯\_(ツ)_/¯
- true_religion 10y agoAn observable cannot change as other. If you attempt it the mobx internals will throw an error. It's been the source of finding logical errors in my code. Also the size of the lib doesn't contribute to calling it magical. Something is magical when it is complex to reason about, due to taking arbitrary seeming decisions behind the scenes.
- atoko 10y ago