▲ | MrJohz 3 days ago | |||||||
A lot of UIs have redundant data, it's very common to have the same data represented in different ways. Consider the comments page on HN, for example, which has plenty of duplicate information: The list of comments on a submission tells you how many comments exist, but the comment count is also made explicit at the top of the page directly underneath the submission title. If one person comments multiple times, their user name will appear multiple times on the page, despite being the same every time. All the timestamps are presented as relative timestamps, which means they're all dependent on the current time. Now this is a very simple page, and it's not so important that everything be updated live. But if it were, you'd need to update every single timestamp on the page, keep all of the usernames in sync in case a user changed their name, insert new comments while also updating the comment count, etc. There is a lot of redundancy in most UIs. In fact, I vaguely remember one of the early React blog posts using a very similar example (I think something to do with Messenger?) to explain the benefits of having a data-driven framework rather than using the DOM as the source of truth for data. For a messaging application, it's much more important that everything be live, and that elements don't end up out-of-sync. | ||||||||
▲ | wordofx 3 days ago | parent [-] | |||||||
HN is static data. It doesn’t update. Re-rendering a user name 20 times doesn’t matter. | ||||||||
|