N
N
nurdus2019-01-03 21:17:34
Vue.js
nurdus, 2019-01-03 21:17:34

Does it make sense to create getters just before the fields of the object in the state?

Good evening.
There is a user object in storage:

user: {
  _id: 0,
  firstName: "Иван",
  lastName: "Галкин",
  middleName: "Александрович",
  name: "Галкин Иван",
  isActive: true
}

Does it make sense to create a getter of the following type?
getters: {
  _id: state => state.user._id
}

The idea is for the storage to be more independent, i.e. if in the future it will be necessary to change the structure of the storage, it was not necessary to rewrite the modules that use it. Maybe there are better ways?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question