logoalt Hacker News

QuadmasterXLIItoday at 2:11 PM2 repliesview on HN

i’ve tried this, and it almost almost works to just rebuild the Dom on every state change as a pure function of state without any react or anything. The resulting interface is actually way snappier than react – but preserving local state of elements like what text is highlighted, where the cursor is, which radio button is tabbed to etc turns into a nightmare.


Replies

gf000today at 3:56 PM

With all due respect, I don't believe it is "more snappier than react".

React itself with nothing else is plenty fast. You would have to go way out of your way to see performance differences between different UI approaches, computers are just way too fast to notice whether this click resulting in the div's text changing to +1 is slow or fast, even if the implementation were crazy convoluted.

What makes react apps slow is using it badly, and having 10 other libraries getting in the picture loading fat UI elements, etc.

And frankly these would be much slower in your render everything anew approach.

shimmantoday at 3:13 PM

Based on your description it sounds like you were halfway into reimplementing the virtual dom that react uses (or use to use? unsure if they moved away from that with the implementation of a compiler).

show 1 reply