Perhaps I'm missing something, but it seems Preact is alot heavier than React in terms of bytes?
https://unpkg.com/browse/[email protected]/dist/ - Production minified 9.3kB
https://unpkg.com/browse/[email protected]/cjs/ - Production minified 6.64 kB
For React you also have to include: https://unpkg.com/browse/[email protected]/cjs/ since both are needed to make an application.
The best way is to compare gzip sizes:
And here's Preact:
As @JoviDeCroock said you need to take react-dom into account. The react package itself contains just the reconciler and no logic on how to render into the web. That's what react-dom comes into play. Preact is basically react + react-dom combined.
Here are the current sizes for the lazy:
| Framework | Size (min+gzip) |
|---|---|
| React + ReactDOM | 38.8kB (2.6kB + 36.2kB) |
| Preact | 3.6kB |
Most helpful comment
For React you also have to include: https://unpkg.com/browse/[email protected]/cjs/ since both are needed to make an application.
The best way is to compare gzip sizes:
And here's Preact: