|
|
|
|
|
by azangru
2491 days ago
|
|
This sounds very arbitrary, opinionated, and unconvincing. If a class is a co-location of data and methods performed on it, then how is this class: class Foo {
constructor(value) {
this.value = value;
}
addOne() {
this.value++;
}
getValue() {
return this.value;
}
}
const foo = new Foo(1);
any worse than this POJO: const foo = {
value: 1,
addOne() {
this.value++;
},
getValue() {
return this.value;
}
}
Besides, what are models and controllers in React codebases, and why is using classes for one of these groups any better than for the other? |
|