Preact: The fast 3kB open source alternative to React
Preact, the open source alternative to React, promises a tiny footprint where your code is the biggest part of the application. This library boasts a lightweight framework and a speedy performance making it a tempting alternative to React.
Concerned about React’s size? How about its mobile app performance? There are a number of alternative libraries, but none of them can compare to the tiny library size and performance ability of Preact. The open source alternative to React is a speedy, lightweight library option.
Preact claims to provide the thinnest possible Virtual DOM abstraction on top of the DOM. As they point out, “the web is a stable platform. It’s time we stopped re-implementing it in the name of safety.”
Also, Preact is a first-class citizen of the web platform. It diffs Virtual DOM against the DOM itself, registers real event handlers, and plays nicely with other libraries. It should be compatible with most, if not all, React libraries. It’s designed to seamlessly work with the thousands of React components out there in the ecosystem.
Little, but mighty
Even though it’s lightweight, Preact is still productive. Here are some interesting bonus features beyond the ordinary react ones:
contextare passed to
- Use standard HTML attributes like
- Works with React DevTools right out of the box
Gone in milliseconds
Preact is small, but mighty quick. Its small size means it can implement code quickly. It’s one of the fastest Virtual DOM libraries out there, thanks to a simple and predictable diff implementation.
Here’s a TodoMVC Benchmark test that we ran. The results are pretty clear: Preact beat React by a country mile. You can try it out for yourself here.
Preact even includes extra performance features like customizable update batching, optional async rendering, DOM recycling, and optimized event handling via Linked State.
Preact’s tiny footprint means you can take the powerful Virtual DOM Component paradigm to new places it couldn’t otherwise go. Use Preact to build parts of an app without complex integration. Embed Preact into a widget and apply the same tools and techniques that you would to build a full app.