Answer the question
In order to leave comments, you need to log in
Is the use of the toComponent method part of a convention?
Hello.
I'm sorting out someone else's project here, and almost everywhere I stumble upon the "toComponent" method, in which the node returns data about entities. For example like this:
...
toComponent () {
return {
list: this.history.map(h => ({
id: h.id,
dateCreate: h.dateCreate,
operation: moderatorOperations[h.operation],
comment: h.reason,
moderator: this.users.get(h.moderatorId),
})),
};
}
...
Answer the question
In order to leave comments, you need to log in
The fact that different programmers in one project wrote the same thing is a sign of a good project and good programmers. Or in the project it was accepted explicitly, then this agreement for the project or so it happened and it simply does not change.
"In general" there is no such agreement, and indeed there are quite a few general practices outside of those recommended in the docks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question