Live data from Hacker News

Preact : a smaller, faster React alternative

blog.logrocket.com

21–30 of 49 posts

Re: Preact : a smaller, faster React alternative

#21
post #9
post #3

To all people who write React-alternatives: please modularize as much as possible. For example, JSX-like syntax is not necessary and some developers might not want to use it; therefore, it should be in a separate module that is completely optional. Also, the virtual-DOM part may be useful in itself, therefore it should also be a separate module. React offers some tools to more easily manage state, but please acknowle…

I disagree, and prefer monolithic frameworks than modular ones. Catering for a common configuration of modules allows the maintainer and contributors to make more assumptions. These assumptions allow them greater freedom to optimize performance and simplify interfaces. Lego like frameworks have to be uber generic thus catering to theoretical computer science aesthetics rather than real world practical use cases. if a…

Echoing this. Some personal anecdotes:

Back in 2012, I remember when Backbone Marionette broke into pieces. It made "logical" sense, but the instances you'd actually want to pull in the event library without taking in Marionette is rare.

There's a certain sense you have to be tactical with decoupling stuff. I decouple front ends from libraries because I don't want my users to be forced to use my CLI front end when they just want an abstraction with minimal requirements.

I get away with it because there's 1 library and 1 frontend.

In JS, there's a front end, a library, and an extension marketplace that make you wonder what they were thinking when they were decoupled. Stuff like extract-text-webpack-plugin.

Guess what that plugin does: It allows you have your CSS show up as CSS files instead of JS. But the title denote that, (forget that fact you'd expect webpack to have such simple stuff in webpack itself.) It instead is "extracts text", despite the fact the convention of "text extraction" means nothing to web developers.

Re: Preact : a smaller, faster React alternative

#22

Is this viable to use as a drop in replacement for React? I am concerned about the license using React, that would be the sole reason to chose something else. I also got few projects in React that we would like to keep.

It can be an almost drop in replacement for many projects. You may have to lean on the officially offered https://github.com/developit/preact-compat depending on the project. If you add preact-compact you do lose some of the size advantage over react but that's not really an issue if licensing is your main concern.

Seems the preact author might want to consider marketing preact as not only the lighter weight alternative, but also the MIT licensed alternative to react (Although if more projects included that surprisingly controversial patent clause it would mark the end of software patents. Isn't that a good thing?)

Re: Preact : a smaller, faster React alternative

#23
post #19
post #3

To all people who write React-alternatives: please modularize as much as possible. For example, JSX-like syntax is not necessary and some developers might not want to use it; therefore, it should be in a separate module that is completely optional. Also, the virtual-DOM part may be useful in itself, therefore it should also be a separate module. React offers some tools to more easily manage state, but please acknowle…

I'm sorry, why would you be using React etc unless you wanted virtual DOM and JSX. Much of why I like React is precisely because it has those features. This really makes no sense to me.

You can use React and virtual dom without JSX. Not that it's pleasant though.

Re: Preact : a smaller, faster React alternative

#25
post #18

Earlier quoted context omitted.

Patents regard underlying functionality so if Preact infringes on the patent through using the same or sufficiently similar mechnism's to react functionality, it's a toss up but due to the nature of open source code the user might be liable. Depends on the ruling of use of open source code that is in a way productized. Also depends on if Preact's implementation is sufficient to infringe on React's patents (if they ha…

The "Patent" issue with React is not with the patents related to React but with its license, so it would not impact Preact.

Nope. If Facebook owns any patents for mechanisms that are used in Preact, they can sue you.

I'll say more: if you use Preact and there are such patents (I have no idea if there are any), they could sue you even if you don't sue them first, because Preact isn't covered by any patent grant.

Re: Preact : a smaller, faster React alternative

#27

Is this viable to use as a drop in replacement for React? I am concerned about the license using React, that would be the sole reason to chose something else. I also got few projects in React that we would like to keep.

Be very careful. If FB holds any patents covering React, they are also enough likely to cover Preact. And there is no patent grant at all with Preact.

Re: Preact : a smaller, faster React alternative

#28
post #19

Earlier quoted context omitted.

I'm sorry, why would you be using React etc unless you wanted virtual DOM and JSX. Much of why I like React is precisely because it has those features. This really makes no sense to me.

You can use React and virtual dom without JSX. Not that it's pleasant though.

I definitely preferred Mithril's m('div') over JSX . The closing tags are overly verbose for me.

Re: Preact : a smaller, faster React alternative

#29
post #19

Earlier quoted context omitted.

I'm sorry, why would you be using React etc unless you wanted virtual DOM and JSX. Much of why I like React is precisely because it has those features. This really makes no sense to me.

You can use React and virtual dom without JSX. Not that it's pleasant though.

> Not that it's pleasant though.

"Raw" react is perfectly OK, and react + hyperscript[0] is great.

[0] https://github.com/mlmorg/react-hyperscript

Re: Preact : a smaller, faster React alternative

#30
post #28

Earlier quoted context omitted.

You can use React and virtual dom without JSX. Not that it's pleasant though.

I definitely preferred Mithril's m('div') over JSX . The closing tags are overly verbose for me.

FWIW the hyperscript helper is generally h rather than m, and there's a hyperscript helper available for react with the expected semantics[0]: https://github.com/mlmorg/react-hyperscript

[0] in the sense that it supports normal hyperscript semantics and replacing the selector with a React component

Post reply on HN