by sirsuki on 1/8/21, 6:48 PM with 1 comments
by sirsuki on 1/8/21, 6:54 PM
I really liked the idea that a JS class could represent a custom element. But the need to know when something should be rendered or not and knowing what to update was always a large ask and the reason VirtualDOM like libs were made. In this case I leveraged the ideas of tracking changes by means of tracked proxies which result in memoized function calls. Thus a Component can be split into two simple responsibilities: DOM update code and noting when something tracked is changed.
The big win here is that VanillaJS can leverage the idea of auto-tracking in that only one tracked thing needs decorating and any call stack that touches that one thing will be auto-recomputed when needed.