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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: React-Most – Declarative Monadic Reactive State Container for React

47 点作者 oyanglulu超过 8 年前

7 条评论

mhink超过 8 年前
First and foremost, I applaud the effort to encourage FRP in React applications, especially in the form of an actual library which treats it as a first-class citizen. I think this library is a step in the right direction for state management in Javascript. However, I <i>do</i> have a few thoughts.<p>When I first looked at this, I couldn&#x27;t tell very clearly what advantages this library has over existing approaches to sequenced Redux actions, such as redux-loop or redux-saga, but I think I&#x27;ve got it now. The problem was that I&#x27;ve always thought of Redux actions as a &quot;stream&quot;, so I wasn&#x27;t clear on how this library was different.<p>It looks like you still have stores, but they&#x27;re completely hidden in the HOC created when you `connect()` a React component to a stream (or a composition of streams) of intents.<p>I think this approach is interesting, and I really like the fact that the FRP mindset is &quot;baked into&quot; the library like that, but I don&#x27;t think it makes a strong enough case for me, personally, to abandon the single-store approach.<p>On the other hand, I <i>do</i> believe that it sheds light on a Redux anti-pattern I&#x27;ve seen emerging: namely, the use of complex selectors which &quot;reach into&quot; the Redux store to pull out data in the appropriate shape required by a React component. In other words, Redux becomes a database, and selectors become queries.<p>The alternative (and better) approach, in my opinion, is very similar to how this library works. Where possible, create focused, denormalized reducers which store data in the closest possible representation to how it&#x27;s intended to be consumed. By doing this, you can nearly eliminate the need for libraries like `reselect`.<p>At any rate, I&#x27;m rambling. In the end, I think the concept behind react-most is great, but I think its benefits are equally attainable in Redux, given good consideration and design.
griffinmichl超过 8 年前
Really awesome little library. Nice work. I&#x27;m always excited to see different approaches for making react &#x27;reactive&#x27;.
dawidloubser超过 8 年前
It&#x27;s been interesting to watch so many ECMAScript &#x2F; React libraries inch towards a Functional-reactive &#x2F; streams-based paradigm. I can&#x27;t wait to see which one becomes the de-facto standard, like how Redux is currently the de-facto implementation of the &quot;flux&quot; pattern in React applications.<p>Of course, <a href="https:&#x2F;&#x2F;cycle.js.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;cycle.js.org&#x2F;</a> is one of the original attempts at a pure and simple implementation, and if you haven&#x27;t studied it yet, it&#x27;s wonderfully enriching to understand and play with - even if you don&#x27;t end up using it in a project. (you may use Cycle.js with React, but it is agnostic of UI library)<p>As a software engineer in the third world, doing work mostly in the corporate space, I observe a near un-crossable chasm between the mindset required to understand and use Functional &#x2F; Functional-Reactive platforms, and the mindset of your typical developer - doing .NET, Java EE or Spring. I fear it may be some time before we see adoption of libraries like these in the mainstream &quot;day job&quot; software world.<p>I don&#x27;t mean to say that FRP is always &quot;better&quot; - but rather that it is beyond the comfort zone of typical corporate devs, despite the simplification its adoption may entail. Don&#x27;t know if engineers outside of South Africa encounter the same problem?
评论 #13130058 未加载
ctvo超过 8 年前
Any advantage to just using Redux Observable and Rx (<a href="https:&#x2F;&#x2F;redux-observable.js.org" rel="nofollow">https:&#x2F;&#x2F;redux-observable.js.org</a>)?
imjared超过 8 年前
Looks neat and absolutely love the diagrams. Thanks for your work.
joshwa超过 8 年前
Buzzword bingo!
polskibus超过 8 年前
Can anyone explain what value does &#x27;monadic&#x27; give to react?
评论 #13125229 未加载
评论 #13129630 未加载