Hacker News new | ask | show | jobs
by untog 2862 days ago
A lighter-weight and largely API-compatible replacement for React: Preact.

https://preactjs.com/

2 comments

Sure. If you still want to be React-like, that is! But React, Preact are still view libraries right? Mithril is a (reasonably) complete framework. It's sufficiently similar to React that if you know React, you can get productive in Mithril very fast. I guess mithril is for people who want a full framework with no fluff that gets out of the way.
> But React, Preact are still view libraries right?

No, they're component-oriented. View suggests you're doing MVC or similar. You don't need an M & C with React -- you will likely need to add react-router, but react + react-router (or preact + preact-router) is all the 'framework' you need for most apps.

Ok. For that matter, Mithril is also component-oriented and router is included.

And what I meant by react being a view library is that react by itself only handles the UI part and you need to get additional libraries to handle stuff like routing and talking with the server. This stuff is provided by mithril itself.

> If you still want to be React-like, that is!

Well, you (or the author) are comparing it to React in your title, so of course people assume that you're targeting React devs.

Now you're saying that it's something different?

I'm saying Mithril is a simpler alternative to React, not React-like. Preact is react-like (same API as react); Mithril isn't.
jQuery is simpler than React. HTML is simpler than React. What a weak selling point, then.
It seems you're missing the point. React and Mithril both employ virtual DOM, both use components and both allow higher abstractions that provide ways to manage complexities that arise in front-end development. Jquery and HTML don't do that.

I tried both Mithril and React and found Mithril to be simpler than React as it 'gets out of the way'.

I invite you to read this for more detailed comparison :

https://mithril.js.org/framework-comparison.html#react

And it is even smaller than Mithrill, Preact being 3kb and Mithril 8kb.
mithril.js includes a router and an ajax helper (that is much simpler than fetch)

If you include those in preact they may have similar size.