TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Preact, a fast 3k React alternative

224 点作者 davideschiera超过 9 年前

22 条评论

Cartwright2超过 9 年前
I&#x27;m not sure that we should be doing this.<p>Yes, it stands to reason that if you take framework X, cut out a lot of functionality, remove some of the &quot;ugly&quot; code that addresses edge cases, then you end up with a similar, reduced framework which is smaller in file size.<p>But this is done at the cost of polluting the Javascript framework environment. The biggest problem right now is pollution, we&#x27;re all drinking from the fire hose of frameworks and someone needs to cut the supply so we can double-down on the good stuff and stop jumping from one framework to the next like a plastic bag caught in a strong breeze.<p>Preact is now a decision point for any developer who Googles &quot;react alternative&quot; and scans far enough through the search results. This isn&#x27;t right. This contributes to decision fatigue. It&#x27;s time to stop churning out new frameworks that are only marginally different from what&#x27;s already available.
评论 #10991353 未加载
评论 #10991965 未加载
评论 #10993141 未加载
评论 #10991574 未加载
评论 #10993979 未加载
评论 #10992025 未加载
udp超过 9 年前
We don&#x27;t need smaller frameworks, we need more <i>modular</i> frameworks. If the framework is modular you can take what you need, and replace the parts you don&#x27;t like.<p>I&#x27;m using mercury [0] in my current frontend project for this purpose. Most of the features of React, none of the commitment. Every single component is interchangeable; the core repository is simply an index.js requiring other modules, which can be depended on individually if you&#x27;re not looking for a kitchen sink solution.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;Raynos&#x2F;mercury" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Raynos&#x2F;mercury</a>
评论 #10991133 未加载
评论 #10990371 未加载
评论 #10992386 未加载
评论 #10990835 未加载
评论 #10989855 未加载
评论 #10990387 未加载
评论 #10991252 未加载
rygine超过 9 年前
It&#x27;s always interesting to see a fresh take on something already in use, especially when the focus is on optimization.<p>However, I completely disagree that Preact is a &quot;React alternative.&quot; React is not simply a bunch of code. It&#x27;s an entire ecosystem with a large community supported by a well-funded entity. A lot of these new libraries and&#x2F;or frameworks popping up seemingly every other week and claiming to be an alternative to X are just not up to par with the competition and&#x2F;or the expectations of developers.<p>Whenever I see something new on the radar, I look at the documentation and commit history. Anything unproven without good documentation, examples, unit tests and&#x2F;or performance tests is just ignored. If I really like the concept, I&#x27;ll bookmark it and check on it periodically.
losvedir超过 9 年前
Where do the savings come from? I can&#x27;t imagine that React.createClass() is all that much code. I&#x27;m guessing a lot of space saving comes from not doing PropTypes (which I find immensely useful) and not having a synthetic event system (meaning you can&#x27;t test with TestUtils.Simulate.click()). What else is missing I wonder?
评论 #10992459 未加载
评论 #10990103 未加载
评论 #10989228 未加载
评论 #10990086 未加载
jallmann超过 9 年前
Off-topic, but am I the only one who thinks that classes are the most puzzling feature of ES6?<p>How is writing &quot;class Blah extends Component { ... }&quot; any better than &quot;Blah = Preact.createComponent({ ... })&quot;, except to save a few keystrokes?<p>ES6 is full of syntactic sugar to improve readability, but classes substantially increase the &quot;surface area&quot; of the language for... what benefit? Static analysis and tooling, maybe? In that case, why not wait until ES7 is fully baked to build interesting features around the type system, instead of making yet another Java derivative...
评论 #10990020 未加载
评论 #10992059 未加载
评论 #10992477 未加载
评论 #10994067 未加载
levisegal超过 9 年前
How does this stack up versus something like riot.js? <a href="http:&#x2F;&#x2F;riotjs.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;riotjs.com&#x2F;</a>
评论 #10990289 未加载
dchest超过 9 年前
I started using Snabbdom, which is also tiny, but has a nice module&#x2F;hook API: <a href="https:&#x2F;&#x2F;github.com&#x2F;paldepind&#x2F;snabbdom" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;paldepind&#x2F;snabbdom</a> (plus &#x27;style&#x27; module supports transitions&#x2F;animations).
holic超过 9 年前
Compared to React, what <i>isn&#x27;t</i> available in Preact?
评论 #10989291 未加载
rpedela超过 9 年前
How big is React gzipped? How much are you saving with this library?
评论 #10989069 未加载
评论 #10989076 未加载
corywatilo超过 9 年前
Yeah, there&#x27;s already a company called Preact. =]<p>preact.com
评论 #10990642 未加载
girvo超过 9 年前
Interesting. In terms of &quot;React alternatives that are tiny&quot;, 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 &quot;Flux Challenge&quot; implementation with that same combo [2].<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;creationix&#x2F;domchanger" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;creationix&#x2F;domchanger</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;jesseskinner&#x2F;hoverboard" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jesseskinner&#x2F;hoverboard</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;girvo&#x2F;domchanger-hoverboard-flux-challenge" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;girvo&#x2F;domchanger-hoverboard-flux-challeng...</a>
lhorie超过 9 年前
Re: fast claim, it turns out it&#x27;s not that fast: <a href="http:&#x2F;&#x2F;localvoid.github.io&#x2F;uibench&#x2F;" rel="nofollow">http:&#x2F;&#x2F;localvoid.github.io&#x2F;uibench&#x2F;</a> :(
评论 #10993134 未加载
igl超过 9 年前
Unfortunately no word on browser compat. But wow. I thought <a href="https:&#x2F;&#x2F;github.com&#x2F;Lucifier129&#x2F;react-lite" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Lucifier129&#x2F;react-lite</a> was slim.<p>Is there a 1k-React challenge going on?
评论 #10994645 未加载
ivanceras超过 9 年前
I&#x27;ve look at react, angular, mithril, and lately elm. It seems elm is here to stay.
kansface超过 9 年前
The value proposition of Preact makes no sense to me:<p>&gt; 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.<p>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&#x27;t even matter on mobile. Can anyone give me a compelling use case?
评论 #10992282 未加载
nnx超过 9 年前
How does this compare to Riotjs &quot;A React-like user interface micro-library&quot; ? riotjs.com
评论 #10992751 未加载
mikemikemike超过 9 年前
less code !== faster code. I wouldn&#x27;t even try this without seeing some impressive performance benchmarks. Giving up the support of the entire react team and community in exchange for a small framework that may or may not be faster is a huge ask.
评论 #10999838 未加载
fibo超过 9 年前
It makes sense stay tiny if you are creating a small component yo be exported.
amelius超过 9 年前
And now we&#x27;re all hoping for Preact Native...
评论 #10992575 未加载
elcct超过 9 年前
I was thinking about something like that today and now I see this. Awesome!
harryf超过 9 年前
Oh another JavaScript framework. Of course the world needs that.<p>If I was recommending a development path to a young developer I would have to say choose the &quot;dark side&quot; and become an app developer and let Apple &#x2F; Google feed you your framework. Don&#x27;t waste your time on the web - you&#x27;ll waste your life learning this weeks flavor of the month framework while lacking core understanding of the underlying technology ( <a href="https:&#x2F;&#x2F;wdrl.info&#x2F;archive&#x2F;121" rel="nofollow">https:&#x2F;&#x2F;wdrl.info&#x2F;archive&#x2F;121</a> ) and never seeing your code amount to anything but a series of band aid and kludges.
评论 #10990264 未加载
评论 #10989628 未加载
评论 #10990735 未加载
评论 #10989658 未加载
eddd超过 9 年前
I am just sitting here, watching elm organically growing, while people creating &quot;new&quot; react-flux-redux-ember-angular-dojo-backbone frameworks every day.<p>I meant to troll, sorry.