19 ms·
Somewhat tangentially, if you’re starting a new project with either, and you intend to use TypeScript, and you suspect you may want to swap out React for someth
by eyelidlessness 6y ago
Somewhat tangentially, if you’re starting a new project with either, and you intend to use TypeScript, and you suspect you may want to swap out React for something roughly API compatible (e.g. Preact), I highly recommend exploring that early on in the project. While Preact is largely API compatible, their respective static types are much less compatible than I would have expected.
- tomduncalf 6y agoOut of interest, what was your reason for doing so? I’ve done a lot of React projects and only once tried Preact, several years ago when we hit some performance issues IIRC (it didn’t help).
- eyelidlessness 6y agoOut of sheer morbid curiosity about how far I could go with optimization. Preact was to be the first step, but the eventual goal was to try to use static analysis to only mount dynamic runtime code that had potential for state change, and make the rest truly static. For the site in question, everything except a hamburger menu could have been reduced to HTML and never touched by any DOM code, and it felt bonkers to ship the same content as JSX. It’s been a while so I don’t remember if Preact was part of that effort or just a separate optimization step that seemed like it should be low hanging fruit.