natemoo-re / microsite

Do more with less JavaScript. Microsite is a smarter, performance-obsessed static site generator powered by Preact and Snowpack.

Home Page:https://npm.im/microsite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React or Preact?

natemoo-re opened this issue · comments

I need to make a decision here. It currently ships with @types/react and does some gnarly transforms to the bundle to swap in preact in a non-ideal way.

The options are:

  • Use react typings and swap in preact/compat at compile time?
  • Drop react and just use bare preact

I am leaning towards dropping React compatibility and only using preact. Please feel free to weigh in on this issue with reactions or comments.

This is obviously a big trade-off, but here are some of my thoughts...

  • React and Preact are likely to diverge at some point in the near future. See (the road to Preact 11)[https://github.com/preactjs/preact/issues/2621]. This is a good move for Preact since React continues to grow in size. As Microsite is focused on performance and size, it's not a bad idea to place our bets on Preact early.
  • The React ecosystem is quite rich, but not as performance focused as the Preact ecosystem. Sticking with Preact likely means that Microsite users don't have as many opportunities for footguns.
  • Preact has phenomenal custom element support, whereas React seems to have little interest in improving their support. Custom Elements are a good ideological fit for Microsite.
  • Microsite is ESM-first and Preact actually ships ESM. React somehow still ships CJS only.

Additional questions:

  • Should Microsite move to htm? This could keep the clientside code close to 1-to-1 with SSR.