5 ms·
Until we rediscover that manually keeping the DOM up-to-date is tedious and error prone for almost any project and switch to a good middle ground such as Preact
by t0astbread 7y ago
Until we rediscover that manually keeping the DOM up-to-date is tedious and error prone for almost any project and switch to a good middle ground such as Preact or React without a build step
- olavgg 7y agoThere are design patterns that mitigate this, take a look on how you can use the observer pattern to update dom elements or html fragments.
- oftenwrong 7y agoI prefer to just refresh the page. Throw away the DOM and render a new one from scratch server-side.
- t0astbread 7y agoFor simple CRUD apps yes, but this doesn't hold up for more interactive experiences. Also, not everyone wants to maintain a server for everything. Static file serving is just way easier sometimes.
- austincheney 7y agoIt’s not that tedious. Learning to do it properly takes less effort than learning a major framework. You would actually have to do it and learn it for this to make any sense though.
- t0astbread 7y agoI tried both approaches on a recent project and in my experience it gets tedious once my application (and with it, its rendering logic) got more complicated. Manually juggling around listeners and mutable state all over the place just leaves a lot of room for error. (As opposed to leaving all that to some DOM reconciler that I don't have to, essentially, implement myself for every problem.) Initially learning a new paradigm (declarative over imperative in this case) is hard, of course, but it can be worthwhile. Whatever works for you though.