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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Why does React.js truf other innovations like Cycle.js?

6 点作者 stardrive将近 10 年前
I&#x27;m surprised to read the following tweet, made yesterday by Sebastian Markbåge of the React team.<p>&quot;React tried and abandoned the Observable tree approach that @andrestaltz is using but but try out http:&#x2F;&#x2F;cycle.js.org&#x2F; incase we&#x27;re wrong.&quot;<p>I agree Cycle.js is fully reactive while React.js is only partially reactive in it&#x27;s state render function. Something that is missing in React.js is robust interaction and event handling. Both the front&#x2F;data and back&#x2F;event side of a app should be reactive and I think Cycle.js is just using Rx to show the way.<p>More React.js developers have seen the light of Rx recently so how can Rx be argued with? Maybe its just the MVI Framework that React.js does not like? Certainly Cycle.js brings a different sort of observable tree into the arena, exposing a whole new level of interactive computing for web apps.<p>Looking at another statement made by Sebastian Markbåge on April 10th, he admits that a better React.js event strategy is required. I see Cycle.js contributing to this acknowledged gap.<p>https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;react&#x2F;pull&#x2F;1389#issuecomment-86478622<p>What is the verdict?

3 条评论

staltz将近 10 年前
From what I&#x27;ve gathered throughout discussions[1], React has seen some experiments with RxJS Observables (or something inspired by Observables), but they want to avoid the learning curve associated with reactive programming, keeping React beginner-friendly.<p>MVI architecture[2] in Cycle.js is derived from thinking about UIs holistically, and realizing how the user is connected to the application. The user gives events to the application, flowing through a thick layer of abstraction: from hardware (mouse) to operating system, to browser, to DOM, then finally to your application. Intent in MVI is another layer of abstraction between those user events and the program&#x27;s state. The key here is to realize what is the source&#x2F;owner of events: the actual human user. I think it makes no sense to think about events as owned by view components, it doesn&#x27;t match reality. PS: MVI arch can be done with React as well, you can e.g. use document.querySelector().addEventListener() globally and remove events from components. This is how Cycle.js just leverages DOM events (and custom DOM events too).<p>React has tougher challenges though, since they want to contain both DOM and Native and whatnot event systems in the same abstraction.<p>[1] <a href="https:&#x2F;&#x2F;twitter.com&#x2F;sebmarkbage&#x2F;status&#x2F;589966228938063873" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;sebmarkbage&#x2F;status&#x2F;589966228938063873</a><p>[2] <a href="http:&#x2F;&#x2F;cycle.js.org&#x2F;model-view-intent.html" rel="nofollow">http:&#x2F;&#x2F;cycle.js.org&#x2F;model-view-intent.html</a>
评论 #9951633 未加载
stardrive将近 10 年前
LOL, to be even more correct, precise and specific the above should read front&#x2F;event and back&#x2F;data :)
mindcrime将近 10 年前
WTH is &quot;truf&quot;?
评论 #9950505 未加载