I'm learning es6 classes and I'm having a hard time seeing how that would be used in the view. Like if I had a User
class, it seems like it'd be more a backend concern:
class User {
constructor(name, age) {
this.name = name;
this.age = age;
}
giveIntro() {
return 'Hi, I am ' + this.name + ' and I am ' + this.age + ' years old'
}
}
- Why would user creation happen on the frontend rather than giving the data to a backend to store & save where it could persist?
- How could this 'feed' the UI the data it needs to make a list of users?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…