DEV Community

Cover image for Have you used "preact"? react's 3kb alternative
Keff
Keff

Posted on

Have you used "preact"? react's 3kb alternative

I just stumbled across preact "Fast 3kB alternative to React with the same modern API."

Taking a quick look at it, it seems quite robust and it seems it does everything you would want it to, it's also continuously maintained and developed.

I can't see where I would use it though, maybe some personal projects or in machines that don't have that many resources.

If you have used it:

  • Why and in which context did you use it?
  • What do you think about it?
  • Would you use it again?

If you have not used it:

  • Would you consider using it?
  • In what context would you use it and why?

Happy Thursday and happy hacking!

Top comments (11)

Collapse
 
pmkroeker profile image
Peter

We use it all the time. We use preact + typescript as the front-end for a data analytics dashboard. Our clients could potentially be in places with less than stellar internet connections, so trying to reduce codebase size is very important for delivering content quickly.

I would recommend preact to anyone and would use it again.

Collapse
 
nombrekeff profile image
Keff

Cool, thanks for sharing!

What about compatibility with existing React components and libraries? Did you have any problems with this?

Collapse
 
pmkroeker profile image
Peter

I have a bit in the past (back in preact 8), but I have not tried many with the new version (preact X). Compatibility has improved though. We created in house style guides and components that normally could be found in popular libraries.

Collapse
 
marcellothearcane profile image
marcellothearcane

Have you heard of Tauri? It's like Elecron but 0.6Mb instead of 48Mb

Collapse
 
nombrekeff profile image
Keff • Edited

Ohh damn, I have not. I will look into it :)

How efficient is it when running it? Does it consume as much ram as Electron?
And does it use js as well or only Rust?

Collapse
 
marcellothearcane profile image
marcellothearcane

I haven't actually used it myself, a friend told me about it.

RAM is apparently loads less, but I'm not sure about Rust/Node.

Thread Thread
 
nombrekeff profile image
Keff

Okay, no problem, thanks nevertheless! I will look into it, I don't use Electron often, mainly because it's too heavy for small apps.

Collapse
 
nombrekeff profile image
Keff • Edited

I've just seen that the DEV.to team are currently transitioning to Preact :)

From DEV.to Github Repo:
We run on a Rails backend, and we are currently transitioning to a Preact-first frontend.

Collapse
 
acip profile image
Ciprian Amariei

We used it for the widgets our users can generate and embed in their websites. Usage example here: projecthelping.org/volunteer/ The choice was heavily weight by the size and the dev speed.

Collapse
 
seanmclem profile image
Seanmclem

I have not used it. I would consider using it, But the fact that it's not compatible. with a lot of libraries made for react - is a bit of a deal-breaker.

Collapse
 
nombrekeff profile image
Keff

Yup, that's a deal-breaker for me as well.

I have tried using it with some react libraries, it gave me some problems but I could make it work in the end. Although not all the libraries I tried worked!

It also seems they try and add as much compatibility with react as they can, and there are always workarounds.