当使用Redux时,商店应该是真实的唯一来源,并且没有冗余。假设商店的一部分代表了有名字和年龄的人。在传统的面向对象编程的人类可能是这个样子:哪里处理Redux的计算属性?
class Person {
constructor(first, last, birthday) {
this.first = first;
this.last = last;
this.birthday = birthday;
get_fullname() { // ... //}
get_age() { // ... //}
}
然而,方法不允许在终极版存储对象。那么,这些“方法”应该在哪里实施呢?