Sunday, January 21, 2024

Preact: mini React

Learn Preact | Preact: Fast 3kb React alternative with the same ES6 API. Components & Virtual DOM.

The simplest answer is that Preact provides the tools needed to construct complex web applications out of small reusable pieces called Components. What makes Preact unique is that it provides these tools in a uniquely small package: just 3kb of JavaScript code,

preactjs/preact: ⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM. @GitHub (MIT license)

Getting Started | Preact: Fast 3kb React alternative with the same ES6 API. Components & Virtual DOM.


Preact vs. React | Syncfusion Blogs

If performance, speed, and size of the application are important factors to you, Preact is the ideal option. It is mainly utilized to create advanced web apps. For instance, Uber moved to Preact in production to make its PWA lightweight and powerful.

The primary difference between React and Preact is that React uses synthetic events, which are wrapped around the actual events that React has added to make all the events work seamlessly across all browsers.
Preact has discarded these for their performance and code-size issues.
It registers event handlers using the browser’s standard addEventListener. Event nomenclature and behavior are identical to those of simple JavaScript/DOM.