days
1
2
hours
0
1
minutes
1
9
seconds
2
7
search
Tiny footprints in the sand

Preact: The fast 3kB open source alternative to React

Jane Elizabeth
Preact
© Shutterstock / Jens Goepfert

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

One of Preact’s main selling point is its tiny footprint. While most UI frameworks take up the majority of an app’s JavaScript size, Preact is often so small that your code overshadows it. This means less JavaScript needs to be downloaded, parsed, and executed – giving more time for your code. Preact makes it easy to build without struggling to keep a framework under control and within its space.

Even though it’s lightweight, Preact is still productive. Here are some interesting bonus features beyond the ordinary react ones:

  • propsstate and context are passed to render()
  • Use standard HTML attributes like class and for
  • 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

Preact even includes extra performance features like customizable update batching, optional async rendering, DOM recycling, and optimized event handling via Linked State.

SEE MORE: Facebook scraps React as we know it, welcomes successor React Fiber

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.

In conclusion

If you’re looking for a fast, lightweight alternative to React, why not give Preact a try? Head on over to their GitHub or homepage to see what it might be like with this fast library!

Author
Jane Elizabeth
Jane Elizabeth is an assistant editor for JAXenter.com.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of