Skip to content

Vuex #2

@shentao

Description

@shentao

Hey!

First of, nice work with the comparison!

However, I believe the data management section is a bit biased towards React+MobX in a way, that it ignores the existence of Vuex, the state management solution for Vue. This could potentially lead to a false impression (especially for less experienced developers) that with Vue, you’re not able to do proper state management, which obviously isn’t true.

It feels really unfair to compare the state management possibilities of MobX with Vue only, as Vue is not a state management library and it never claimed to be one. There is Vuex for this, which weights just ~7kB, which means Vue+Vuex is still smaller than React or even Preact alone.

If one would add Vuex to the equation, the MobX part could be then translated to:

// Vuex

const store = new Vuex.Store({
  state: {
    firstName: 'Foo',
    lastName: 'Bar'
  },
  getters: {  // computed
    fullName (state) {
      return `${state.firstName} ${state.lastName}`
    }
  }
})

and later added to a Vue component like this:

import { mapState, mapGetters } from 'vuex'

const vm = {
  computed: {
    ...mapState(['firstName', 'lastName']),
    ...mapGetters(['fullName'])
  }
}

By doing so, you would negate most of the cons of using only Vue for state management.

To sum things up:
Even though I agree with the following:

TLDR; React + MobX > Vue

to make the comparison honest and legitimate, Vuex should be included.

I propose the following change to the TLDR section:

TLDR; React + MobX* == Vue* + Vuex
* – where the reactive engine is
== – not strictly equal.

Regards,
Damian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions