Feb 16, 2023
That's a good point.
Ideally, I might introduce either a BFF or ACL (Anti-Corruption Layer) to handle this logic somewhere other than in the UI.
That might not always be the case - you might don't have control of the service side data structure, or change infrastructure in cases not practical, etc.
For the sake of that demo, I would see performance-wise, there isn't too much significant difference, but I believe with the extra abstraction, the code is more understandable.