News for hackers. Stuff that matters.
Re:Idiomatic Redux: Implementation and Intent by te_chris on Friday July 07, 2017 @04:04AM (#14716854)
This comment is always the first, every time, but they're both very different. Mobx is mutable binding, redux is one way, functional data flow. They have their tradeoffs, but when I look at mobx I get reminded of managing crazy state trees in ember and why I went to react/redux in the first place. YMMV.
Re:Idiomatic Redux: Implementation and Intent by mweststrate on Friday July 07, 2017 @07:35AM (#14717616)
> I look at mobx I get reminded of..

Looking like, and being like are two different things :) Mobx reminds people (rightfully) of Meteor, Knockout, Angular etc, but when working with it you will see it is quite a different best. Just like Redux will remind people of flux, but that doesn't mean people shouldn't try Redux because e.g. Facebook Flux didn't work out.

Re:Idiomatic Redux: Implementation and Intent by hesarenu on Friday July 07, 2017 @06:10AM (#14717277)
The crazy state tree in redux is what made me go to mobx. I had events firing off updating multiple redux functions. It was very difficult to understand the flow. Mobx has simplified my changes to one place. To me they both the same managing client side state.
Re:Idiomatic Redux: Implementation and Intent by CuriousSkeptic on Friday July 07, 2017 @08:48AM (#14717906)
Mobx vs redux is probably not the right comparison here though. Mobx comes bundled with 'computed' and encourages most state to be handled there.

Redux doesn't have this, instead libs like reselect fills space.

My experience with redux was frustrating in the way you explained, but once I "got" how to defer all state to reselect instead of trying to do things with reducers it got significantly simpler.

Re:Idiomatic Redux: Implementation and Intent by hesarenu on Friday July 07, 2017 @11:29AM (#14719116)
My frustration wrt redux was organising the file structure where to place actions reducers. Otherwise it was a joy to work with. I considered it very simple and easy to work until I found mobx.
Re:Idiomatic Redux: Implementation and Intent by acemarke on Friday July 07, 2017 @12:03PM (#14719469)
The two typical approaches are "file-type-first" (separate folders for "actions", "reducers", "containers", etc), and "feature-first". I've got articles discussing various React/Redux project structure approaches at https://github.com/markerikson/react-redux-links/blob/master... .
Re:Idiomatic Redux: Implementation and Intent by hesarenu on Friday July 07, 2017 @11:25PM (#14723900)
I have done both approaches, ducks, slight variation on ducks all running on production apps. Still not satisfied.

I have referred your links. Thank you btw.

Re:Idiomatic Redux: Implementation and Intent by Lazare on Friday July 07, 2017 @11:05AM (#14718867)
> they're both very different

Yes, but they exist to solve very similar problems.

> when I look at mobx I get reminded of managing crazy state trees in ember and why I went to react/redux in the first place.

You may find it feels differently in practice. Because when I look at redux, I get reminded of managing crazy state trees in redux, and why I went to react/mobx in first place. :)

To be sure, Redux has strengths too, and there are tradeoffs. But I don't think that a brief "mobx looks like ember!" really conveys much, and I think the number of people who have been happy after switching from redux to mobx further undercuts such easy dismissals.

Re:Idiomatic Redux: Implementation and Intent by cloverich on Friday July 07, 2017 @11:54AM (#14719387)
It deserves to be first, because most people jump into redux because it seems like you're supposed to use it. Also I don't think I agree with the claim that they are very different. In theory, yes. In practice, I use it to solve the same problems in generally the same way (action driven updates, one-way data flow rendering), but with less boilerplate and (for my use cases) better performance. YMMV is fair, but anyone doing serious react work should be at least familiar with both.
Re:Idiomatic Redux: Implementation and Intent by ng12 on Friday July 07, 2017 @12:30PM (#14719698)
But it's a little ridiculous when you can't even mention Redux without MobX being dropped.

Also an important thing to note is that Redux is fundamentally designed to lend itself to one-way data flow with a well-abstracted barrier between global state and your components. Yes, you can use MobX to accomplish the same thing but the pattern is fundamentally less obvious especially for someone new to React.

Re:Idiomatic Redux: Implementation and Intent by cloverich on Friday July 07, 2017 @03:05PM (#14721148)
> But it's a little ridiculous

That's the point I'm contending: Its not ridiculous because its not obvious that its an alternative. And not just an alternative, but a much much simpler alternative for many use cases. I absolutely agree its annoying, and I'll have to be that annoying guy for a while. Because I can't stand seeing people spend time on clever solutions to problems that, with mobx, you may not have.

Re:Idiomatic Redux: Implementation and Intent by ng12 on Friday July 07, 2017 @03:53PM (#14721524)
You'd have a point if the article was intended for people trying to bootstrap a React stack but this is specifically a deep-dive on Redux. It's equivalent to people proselytizing Rust in any thread that mentions Go. Believe it or not some of us are not ignorant -- we know what MobX is and still choose Redux every time.
Re:Idiomatic Redux: Implementation and Intent by cloverich on Friday July 07, 2017 @05:04PM (#14722090)
Actually it's a response to a response about using libraries to help with redux boilerplate. Depending on your scenario, mobx might reduce your boilerplate and your dependencies at the same time. That's absolutely appropriate context. And again while I appreciate not wanting to see those comments if you already know about mobx, not everyone does. I didn't. And I'll forever appreciate running into those comments myself. This isn't a go rust comparison (languages designed for different problems) -- it's a discussion about state management in a ui. I'm sure mobx won't be the only alternative brought up. Thats IMHO a good thing.