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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Why You Shouldn’t Use ReactJS for Complex Projects

43 点作者 sjrd超过 8 年前

20 条评论

JamesMcMinn超过 8 年前
I don&#x27;t think the author of this article really understands what React is and what it is not. They repeat several times that React is a framework - it is not. React is a library, one which you can use to render components and build interfaces. It doesn&#x27;t claim to be a Framework for handling data, and making comparisons between the number of lines required to write tiny TODO applications isn&#x27;t exactly convincing when the argument is that you shouldn&#x27;t use React for complex projects.<p>The author writes off solutions such as Redux which are designed to solve nearly all of the &quot;problems&quot; the author assigns to React because they add extra layers to the application, however in reality, separating your data and your views is EXACTLY the point - that&#x27;s what helps to make complex applications manageable.<p>The article is really an advertisement for the authors own framework Binding.scala, rather than a critical look at React.
评论 #13575671 未加载
评论 #13581138 未加载
评论 #13575861 未加载
评论 #13577077 未加载
acemarke超过 8 年前
Most of this article seems to be complaints about using Javascript, a dynamically-typed and interpreted language, vs using a statically typed compiled language like Scala. The author also seems to dislike the idea of client-side logic and data fetching, as opposed to server-driven.<p>A number of the comments about React are very overstated or overblown. For example:<p>&gt; Since the two versions of virtual DOMs are mutually independent, the React framework has no idea about what is going on in data sources, randomly guessing processing operations depending on just these two DOMs. This kind of algorithm is extremely slow and inaccurate.<p>In reality, unless the component tree is dramatically changed (such as changing to an entirely different screen), the new VDOM contents are likely to be almost identical to the previous contents. React makes a number of educated assumptions about the structure of a VDOM tree to efficiently diff the changes. That does take processing time, but saying it is &quot;slow and inaccurate&quot; is just silly.<p>Ultimately, this article seems to be mostly about bashing React and trying to sell the author&#x27;s Scala HTML bindings library instead.
wereHamster超过 8 年前
&gt; The minimal reusable unit in React framework is React.Component<p>Wrong. And if you think the correct answer is &quot;function&quot; then you are wrong as well. The answer is: an Element. A pure, immutable value representing a React element. Example: const myReusableDiv = &lt;div &#x2F;&gt;;<p>&gt; Developers have to manually replace class and for attributes with className and htmlFor.<p>So? It&#x27;s just syntax. You can teach that, along value interpolation and everything that a designer might need to be able to make changes to templates, in less than five minutes to someone who only knows HTML.<p>&gt; [talking about propTypes]. Yet this mechanism is full of holes.<p>So is JavaScript. Nothing to do with React. Scala is better, obviously. Any statically typed language is better at that. And there even are languages which are better at that than Scala.<p>If you are all like &#x27;lol JS has no types, look at my fancy Scala code&#x27; then I&#x27;ll smack you with my Haskell ADTs. And then somebody from the Agda or Idris camp joins and gives you a taste of dependent types.<p>&gt; [how async programming is bad]<p>Nothing to do with React. React is just for rendering the UI. How you manage the data is entirely up to you.
评论 #13575358 未加载
评论 #13575557 未加载
pedalpete超过 8 年前
I&#x27;m a bit surprised to see this on a site such as infoq, and being written by a developer from Thoughtworks.<p>If you have a &#x27;complex project&#x27; you are going to need more than just ReactJS. It&#x27;s like saying Handlebars templating is no good for large projects.<p>The reusability of components in a large project, and specifically the issues the author points out about interactivity between components, isn&#x27;t supposed to be done in react, you&#x27;re supposed to have a data (store) layer which manages the state of your components. This means the component itself is essentially just an template for your output.
评论 #13574946 未加载
ola超过 8 年前
This article purposefully misrepresents React in favor of the author&#x27;s own framework Binding.scala, all the criticism are either superficial like class being className (which is a good thing because JSX is not HTML) or has nothing to do with React like JavaScript&#x27;s dynamic typing system and handling of asynchronous updates.<p>He also seems to believe that React is framework when it&#x27;s a library, if his knowledge of React is so shallow that he didn&#x27;t even read the first sentence on the React website I can&#x27;t take his opinions on it seriously.<p>I don&#x27;t like these kinds of articles which are only thinly veiled advertisements that do not offer any thoughtful criticisms, what I would really like is to hear from someone who has actually worked on a huge project which includes React and what troubles if any they ran into.
评论 #13575443 未加载
FLGMwt超过 8 年前
Some of these grievances might be better titled &quot;things that thew me off when learning React&quot;.<p>I&#x27;m not quite sure how using &quot;className&quot; vs &quot;class&quot; materially affects a complex project.<p>propTypes are pretty shallow in terms of checking, but I&#x27;ve seen them more as something third party components should provide as metadata&#x2F;documentation rather than replacing a type system. Large project should rely on Flow or TypeScript if they&#x27;re worried about typings.<p>I&#x27;m not sure I follow the complaints against asychronicity? Maybe when dealing with improperly complex components it becomes tricky and that I think takes experience to get a feel for.<p>Additionally, if we&#x27;re comparing what appears to me to be a synchronous two way binding pattern to React, I think it&#x27;s really just a matter of choosing the wrong technology for a given preference. React and the omnidirectional data flow pattern are directly opposed to that.
评论 #13575802 未加载
评论 #13575814 未加载
mattashii超过 8 年前
&gt; Though Binding.scala somewhat looks like React, the mechanism hidden behind it is easier and more universal, which is completely different from React and Widok.<p>&gt; Apparently, Binding.scala is more flexible and powerful. We can use Binding.scala to solve complicated issues that React cannot.<p>How did the author come to this conclusion?<p>He only complained about issues he saw in React, he didn&#x27;t really compare them to how it would work in binding.scala. I&#x27;m sorry, but I find this post a badly written example of `software A is bad and therefore you should use software B, even though it is not examined critically`<p>*edit: formatting
评论 #13581114 未加载
toast76超过 8 年前
Article bashing React, written by the author of the library he suggests you use instead.
abeaclark超过 8 年前
<a href="https:&#x2F;&#x2F;github.com&#x2F;reactjs&#x2F;redux" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;reactjs&#x2F;redux</a>
htormey超过 8 年前
I disagree with at least one of the authors critiques:<p>&quot;Issue 1: React components are difficult to reuse in complex interactive web projects.<p>Such a lightweight component is very handy in rendering plain and static webpages. Nonetheless, when there are interactions between one component and another, passing callback functions as parameters are inevitable. Particularly for webpages with complicated structures, we have to nest dozens of components from the inside-out, where those callback functions are passed through from parent to child components across layers and layers. The only outcome for applying React framework in complex interactive web projects is that the codebase would become too messy to maintain.&quot;<p>Out of the box React is relatively spartan, which is great for small projects. At scale it only really comes into its own when used in conjunction with other things such as Redux and its wonderful ecosystem of middleware.<p>In this kind of situation, I would advise using something like Redux and following the advice of Dan Abramov (Redux creator). He wrote a wonderful article on how to split functionality between components and containers:<p><a href="https:&#x2F;&#x2F;medium.com&#x2F;@dan_abramov&#x2F;smart-and-dumb-components-7ca2f9a7c7d0#.6xmuhf2rx" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@dan_abramov&#x2F;smart-and-dumb-components-7c...</a><p>I think this is a great pattern to follow for larger scale projects.<p>&quot;It is well-known that React is a great tool for implementing simple interactive websites, but how does it apply on complex interactive front-end projects?&quot;<p>Facebook seems like a pretty complex website to me and they are all in on React.<p>As to his points about the virtual DOM performance, I&#x27;d love to hear a more experienced web dev chime in on that as my area of expertise is native development.
评论 #13575491 未加载
yawaramin超过 8 年前
A quick correction to the following claim:<p>&gt; ... if you wanted to insert &lt;li&gt; on the top of a &lt;ul&gt; form, then the React framework would misjudge that you modified all components of &lt;ul&gt; and appended &lt;li&gt; at the end.<p>Yes, that will happen ... but only if you don&#x27;t assign a key property to each of the `&lt;li&gt;`s. React uses the key prop to uniquely identify nodes that were actually changed versus ones that were just moved around among their peers. So if you&#x27;re dynamically creating lists of nodes of the same tag type, you really need to be giving them a unique `key`.<p>Also, it&#x27;s not a framework, it&#x27;s a library. A framework calls your code, a library gets called by your code. With React you call `ReactDOM.render` or similar.
sarreph超过 8 年前
&gt; Particularly for webpages with complicated structures, we have to nest dozens of components from the inside-out, where those callback functions are passed through from parent to child components across layers and layers.<p>Does anyone have any tips for avoiding this extremely irritating &#x27;props-nesting&#x27; (as I like to call it)? I&#x27;m pretty new to React, and the one thing that&#x27;s bugging me about it is that in more complex UI (for example, a toolbar that independently controls a nested component), is how you can&#x27;t just go through a top-level component directly; you have to go all the way up and down the chain. This gets very messy once you decide to change some of the intermediate components fundamentally.
评论 #13575471 未加载
评论 #13575437 未加载
评论 #13575451 未加载
jondubois超过 8 年前
I think React is a good framework but it&#x27;s not as elegant as Google&#x27;s PolymerJS in my opinion. React&#x27;s main strengths are its large community (which means lots of plugins and add-ons) and its native device support (React Native).<p>My main problem with React is that it&#x27;s more complicated than it needs to be - If following an architecture like Redux, you often end up with long complex chains of reducers and components which makes the logic very hard to follow - Especially if you like to split up your code across multiple files.<p>There are few things worse than having 10+ files open at the same time and having to figure out which one(s) is&#x2F;are the cause of your problem.
评论 #13575495 未加载
评论 #13575452 未加载
hoodoof超过 8 年前
Nup - none of these criticisms seem valid to me.<p>And a particular comment about asynchronous programming - ALL JavaScript requires async programming and you need to know how to properly handle it no matter what you are programming.
umurkontaci超过 8 年前
Well,<p><a href="https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;react&#x2F;wiki&#x2F;sites-using-react" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;react&#x2F;wiki&#x2F;sites-using-react</a>
iLemming超过 8 年前
Every front-end engineer knows - React is a library and not a framework. From my own experience one of the best ways to see where React shines is to try out one of Clojurescript libraries, and there are plenty to choose from: Rum, Re-frame&#x2F;Re-agent, Quiescent, Om.Next. React plays extremely well with immutable data-structures. Om.Next is mind-blowing awesome.
KayL超过 8 年前
Having no experiences with it. The author calmed that is faster but the benchmark result in below chart was shown different word:<p><a href="http:&#x2F;&#x2F;www.stefankrause.net&#x2F;js-frameworks-benchmark5&#x2F;webdriver-ts&#x2F;table.html" rel="nofollow">http:&#x2F;&#x2F;www.stefankrause.net&#x2F;js-frameworks-benchmark5&#x2F;webdriv...</a>
评论 #13575726 未加载
tomelders超过 8 年前
Well, that&#x27;s one way to turn people off to your new framework. Maybe something got lost in the translation? Maybe this reads better in the original language? Maybe not. But even then, as many people have already commented on, it&#x27;s just plain wrong about React.
cwyers超过 8 年前
I don&#x27;t know, Facebook seems like a pretty complex project and they use React.
jiyinyiyong超过 8 年前
React is not good enough since it&#x27;s based on JavaScript. Swapping the language to ClojureScript or ReasonML, the situation will change.