by dgb23 · 3y ago · 0 comments
I needed to do calculations and reading bounding boxes from the DOM initially and on resize. Basically a hack to get around CSS limitations.
It was crucial that this is fast enough to avoid flickering.
I wouldn’t have attempted this with react. I think it would still be possible with useEffect, but I tried the most lightweight and fast by default approach that was feasible.
Have a look at lithtml.
Aside:
That’s why I‘ve been gravitating towards approaches that have much simpler execution models.
You can still do declarative and functional. But you have more control when needed, create _much_ smaller bundles, have fewer dependencies, better default performance, allocate less garbage and you can reason about your code in more fundamental ways.
In cljs this would mean to not use a react wrapper.
However I personally try to avoid using any deps for frontend, and that includes cljs. Any dep needs a justification IMO.
That justification is often not good enough, since I’m mostly writing „interactive documents with some fancy parts“.
If you’re writing something like nextjournal, roam, data rabbit or similar then it’s a different story.