Hacker News new | ask | show | jobs
by ratww 2281 days ago
Preact is great by itself, and works very well. All the advantages are true, it's fast and about 10x smaller than React [1]. It's GREAT for super-small interactive apps that need to be fast.

But if you try to use it as a drop-in replacement for React [2] and use a lot of third-party React components, Redux, React Router, then you might run into incompatibilities. React is very large and some components rely on obscure behavior, sometimes bugs. You'll have to do some deep diving and opening PRs in third-party repos, and a lot of those people will even deny those PRs.

But honestly: if you're gonna use third-party stuff, Redux, React Router, all that... is the ~38kb it saves really all that much?

If you're doing startup-style development where number of dependencies don't matter, go with React. If you're aiming for an app with only 30kb or 50kb of gzipped Javascript, maybe try Preact.

I'd it's actually more of a competitor to Svelte or to VanillaJS, not to React.

--

[1] 3750 vs 42623 gzipped for the UMD, last I checked. Used the UMD production dist of both of them. Used React+React-DOM concatenated for measuring React.

[2] Sure, maybe they should drop the compatibility line from their "sales" pitch. It mostly works fine, but it's a hard position for them to be in.