4 ms·
Actually re-rendering the entire app on each change only works for the most trivial apps; in a real-world app, it's prohibitively costly in terms of performance
by carsongross 10y ago
Actually re-rendering the entire app on each change only works for the most trivial apps; in a real-world app, it's prohibitively costly in terms of performance.
Is this true? Slamming HTML into a DOM is pretty fast as far as I can tell.[1]
It seems to me the advantage of DOM diff/swapping is the preservation of non-DOM state (input focus, inner scroll state, etc.)
[1] - http://intercoolerjs.org http://intercoolerjs.org
- mbrock 10y agoImagine swapping the entire HTML of Facebook.com when the user types a letter into a chat input box.
- carsongross 10y agoRight, of course, but that is an event that I would assume wouldn't require any sort of server communication or application redrawing (beyond what the native input widget already provides...) And, if it does, it's not a situation I'm sure I would design a toolkit around...
- jankassens 10y agoTake an input that shows you the number of characters you typed or a form where the submit button is disabled until all required fields are filled in. These kinds of states might change on every keystroke and are not offered directly by a plain text input.
- deleted 10y ago[deleted]