Live data from Hacker News

Preact, a fast 3k React alternative

developit.github.io

71–80 of 142 posts

Re: Preact, a fast 3k React alternative

#72

I'm not sure that we should be doing this. Yes, it stands to reason that if you take framework X, cut out a lot of functionality, remove some of the "ugly" code that addresses edge cases, then you end up with a similar, reduced framework which is smaller in file size. But this is done at the cost of polluting the Javascript framework environment. The biggest problem right now is pollution, we're all drinking from the…

What if you need something very lean for a specific purpose that React would do well, but it is just too big to justify it. That's ironically an edge case where React fails to deliver and this project fits neatly.

Re: Preact, a fast 3k React alternative

#73

Off-topic, but am I the only one who thinks that classes are the most puzzling feature of ES6? How is writing "class Blah extends Component { ... }" any better than "Blah = Preact.createComponent({ ... })", except to save a few keystrokes? ES6 is full of syntactic sugar to improve readability, but classes substantially increase the "surface area" of the language for... what benefit? Static analysis and tooling, maybe…

I could not disagree more.

To me the readability benefit of classes, "extends" and "static" that work intuitively, "constructor", "super", etc. is immense, especially when you pair with something like Facebook Flow that let you declare the members with types. I consider it one of ES6's most compelling features. No more writing out "MyClass.prototype" just to declare basic classes with methods.

Re: Preact, a fast 3k React alternative

#74

Earlier quoted context omitted.

Nope. People should always create and attempt improve upon whats out there. Don't try to stifle innovation for the sake of making decisions simpler. If you don't want to make decisions, don't use libraries, or use an opinionated framework.

> People should always create and attempt improve upon whats out there. Don't try to stifle innovation... I agree completely and my argument is that a lot of the Javascript libraries being pushed around over the past three to four years are neither creative nor improvements over what already exists. React is innovative. Redux is (arguably) innovative. jQuery was innovative. Many other libraries have been innovative.…

Jquery-UI in particular had a lot of competitors, and it just overran all of them before itself dying an ignoble death of stagnation while CSS improved to the point that most of what it offered could be done simply in another way.

Re: Preact, a fast 3k React alternative

#75
The value proposition of Preact makes no sense to me:

> Preact is an attempt to recreate the core value proposition of React (or similar libraries like Mithril) using as little code as possible, with first-class support for ES2015.

I understand building a faster React, an easier to use React (forms are a nightmare), but a smaller React? We are talking about saving on the order of 30kb. This doesn't even matter on mobile. Can anyone give me a compelling use case?

Re: Preact, a fast 3k React alternative

#76
Interesting. In terms of "React alternatives that are tiny", I have a really big soft spot for domChanger[0]. Really cute syntax, and it works pretty well -- I built most of a TodoMVC implementation with it and Hoverboard[1] (a tiny Flux implementation). I also completed a partial "Flux Challenge" implementation with that same combo [2].

[0] https://github.com/creationix/domchanger

[1] https://github.com/jesseskinner/hoverboard

[2] https://github.com/girvo/domchanger-hoverboard-flux-challeng...

Re: Preact, a fast 3k React alternative

#77
post #46

Earlier quoted context omitted.

You can add object properties to a ES6 class's prototype, no? EDIT: Just tested in Firefox and indeed you can.

Not in the class declaration, though. Why force the programmer to go through the prototype, when ES6 provides such a "convenient" abstraction around it?

Coming to the spec soonish and already supported in Babel - https://github.com/jeffmo/es-class-fields-and-static-propert...

Re: Preact, a fast 3k React alternative

#78
post #62

Earlier quoted context omitted.

> People should always create and attempt improve upon whats out there. Don't try to stifle innovation... I agree completely and my argument is that a lot of the Javascript libraries being pushed around over the past three to four years are neither creative nor improvements over what already exists. React is innovative. Redux is (arguably) innovative. jQuery was innovative. Many other libraries have been innovative.…

> These libraries do nothing but add to decision fatigue. Developers have to make decisions, sure, but we need to have limits too. Nonsense. These "me too" libraries add to the decision fatigue only if you're including them in your list of candidate libraries in the first place. Personally speaking, I won't even consider Preact until one of the following events has occurred: 1: I tell myself I really really need a 3k…

I agree with this as well. Just because I've heard of Mithril.js doesn't mean I'm going to now start considering Mithril for my projects.

One of these Javascript libraries could end up introducing an innovative idea or have a feature that other libraries don't. It wouldn't make sense to just stop making them because there's a lot of them out there.

Javascript fatigue only happens when you start giving all libraries equal consideration and using new frameworks just because they're what's "in".

Re: Preact, a fast 3k React alternative

#79

The value proposition of Preact makes no sense to me: > Preact is an attempt to recreate the core value proposition of React (or similar libraries like Mithril) using as little code as possible, with first-class support for ES2015. I understand building a faster React, an easier to use React (forms are a nightmare), but a smaller React? We are talking about saving on the order of 30kb. This doesn't even matter on mob…

>I understand building a faster React, an easier to use React (forms are a nightmare), but a smaller React? We are talking about saving on the order of 30kb. This doesn't even matter on mobile. Can anyone give me a compelling use case?

Less code can also mean its easier to understand and has pruned the legacy/redundant parts (being ES2015 only).

And being able to read the whole code of your framework in one sitting, and understand it, is great.

Besides, it's not like "as little code as possible" is their ONLY goal. They're not merely building a drop-in React replacement with less code. The reference to "Mithril" looks like they'll also investigate their own APIs and ways of hooking components etc, which will be similar in concept but different than React's exact APIs -- they already dropped the non-stateless components APIs.

[addition] Regarding the "order of 30kb savings". Here's an excerpt from their site: "The React-based demo was 1.8mb of JavaScript. This demo, using exactly the same code and with the same functionality, is 60kb.".

Re: Preact, a fast 3k React alternative

#80

Earlier quoted context omitted.

> People should always create and attempt improve upon whats out there. Don't try to stifle innovation... I agree completely and my argument is that a lot of the Javascript libraries being pushed around over the past three to four years are neither creative nor improvements over what already exists. React is innovative. Redux is (arguably) innovative. jQuery was innovative. Many other libraries have been innovative.…

I would actually not consider jQuery to be innovative as much as it was a refinement/improvement of existing libraries such as Prototype and Dojo. I think jQuery is great so this isn't a knock against it, but rather just saying that sometimes one thing comes out that is revolutionary but then something else that is an improvement/iteration on that smooths out the rough edges and becomes "the one framework to rule the…

Improvement on an existing design is still innovation.

The invention of rubber tires WAS innovative, even if we had stone/wooden wheels for milennia.

And the iPod was innovative, even if we had heavy, crappy UI, plasticky third party mp3 players before that.

Post reply on HN