have my object variable data that holds all the data I wanna have on my component data. What is the best practise?
This code sample might explain
const data = {
firstname: "John",
lastname: "Doe",
age: 18,
// much more actually
}
this.firstname = data.firstname;
this.lastname = data.lastname;
this.age = data.age;
// This would actually go too long because of the many data
Object.assign(this, data)
You shouldn't normally need to do this. Where does this data object come from?
Обсуждают сегодня