https://linen.dev logo
Join Discord
Powered by
# react
  • u

    user

    05/21/2019, 9:39 AM
    Completely breaks one way data flow IMO.
  • u

    user

    05/21/2019, 9:39 AM
    But I guess MobX is not trying to follow that pattern.
  • u

    user

    05/21/2019, 9:40 AM
    To be fair the benefit is it's a lot more performant than redux, but that's probably due to not enforcing immutable state at any point.
  • u

    user

    05/21/2019, 9:42 AM
    Whether or not it's two way data binding, it reminds me of it because it's allows you the flexibility to go all over the place for easy wins, and make everything impossible to follow.
  • u

    user

    05/21/2019, 9:42 AM
    hmm, I'm having trouble to unpack "combining two state objects in an issue" ... what do you mean by that?
  • u

    user

    05/21/2019, 9:43 AM
    well, if the alternative is to fiddle with
    connect
    and
    mapPropsToState
    and what not, then Redux doesn't particularly excel either ^^
  • u

    user

    05/21/2019, 9:44 AM
    Basically when it comes to business logic / your side effect model, when you need data from two separate "states".
  • u

    user

    05/21/2019, 9:44 AM
    I like observables but I somehow am really attached to the store data being a vanilla immutable object
  • u

    user

    05/21/2019, 9:44 AM
    As you would do with redux using action creators / redux thunk / saga / etc.
  • u

    user

    05/21/2019, 9:45 AM
    yeah, why don't you just get the data from two separate states? ^^
  • u

    user

    05/21/2019, 9:45 AM
    though I think the store being one and only in an app is meh
  • u

    user

    05/21/2019, 9:46 AM
    (OT @Ronin: I don't think we can @ you from Gitter because of the special chars in your user name)
  • u

    user

    05/21/2019, 9:47 AM
    it's a trick :D
  • u

    user

    05/21/2019, 9:47 AM
    I guess my problem is that they encourage business logic in the MobX store object, or having logic in there at all period, is nonsensical to me.
  • u

    user

    05/21/2019, 9:47 AM
    Copy code
    class TodoList {
        @observable todos = []
        @computed
        get unfinishedTodoCount() {
            return this.todos.filter(todo => !todo.finished).length
        }
    }
  • u

    user

    05/21/2019, 9:47 AM
    That's just a basic getter in that example, but still.
  • u

    user

    05/21/2019, 9:48 AM
    so, what's the problem with that?
  • u

    user

    05/21/2019, 9:48 AM
    You have this zigzag of references, especially when you're referencing another store from one store, and have business logic inside that store.
  • u

    user

    05/21/2019, 9:48 AM
    I like that - if anything this is a mess to do in redux without reselect and co
  • u

    user

    05/21/2019, 9:50 AM
    it's not a "store" ... it's really an object ... if you don't like OOP, I that's your prerogative of course ^^
  • u

    user

    05/21/2019, 9:52 AM
    Well OOP doesn't necessitate coupling logic with data, or two way data binding or inheritance or encapsulation, etc. But yes that "style" of OOP I think has architectural issues, but to each their own.
  • u

    user

    05/21/2019, 9:54 AM
    OOP means encapsulation ... not sure what else it should really mean ^^
  • u

    user

    05/21/2019, 9:54 AM
    Composition is an OOP concept, for example.
  • u

    user

    05/21/2019, 9:54 AM
    I think a more accurate term would be I like stuff to be data-driven.
  • u

    user

    05/21/2019, 9:57 AM
    Yes the redux store's data is just an object - it's not being anti OOP I think.
  • u

    user

    05/21/2019, 9:58 AM
    Explicit observables are fine also, it's the mutation process and when frameworks like Vue transform plain data into observables automatically.
  • u

    user

    05/21/2019, 10:00 AM
    In our apps we move around the components a lot of plain data and I want it to stay plain data - not become in-depth mutatable observable objects
  • u

    user

    05/21/2019, 10:01 AM
    well, that seems like an opinionated choice, not much more ^^
  • u

    user

    05/21/2019, 10:03 AM
    but yeah, I can see why "magic" makes people nervous ... I guess it's just not for everyone
  • u

    user

    05/21/2019, 10:18 AM
    Isn't it all about opinions? :)
1...8910...80Latest