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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Am I wrong in hating React JS?

45 点作者 eibrahim超过 8 年前

15 条评论

ggregoire超过 8 年前
To reply to your complaints:<p>&gt; I hate html in javascript. I hate JSX.<p>At least it&#x27;s just HTML and JavaScript.<p>In my opinion it&#x27;s better than learning a new messy templating DSL, i.e.<p><pre><code> &lt;ul ng-if=&quot;::vm.items.length&quot;&gt; &lt;li ng-class=&quot;::{ &#x27;active&#x27;: item.active }&quot; ng-repeat=&quot;item in ::vm.items | orderBy: &#x27;id&#x27; as ordered track by item.id&quot; ng-click=&quot;item.active = !item.active&quot;&gt; {{::item.name}} &lt;&#x2F;li&gt; &lt;&#x2F;ul&gt; &lt;select ng-options=&quot;item.subItem as item.label for item in ::vm.items2 track by item.id&quot; ng-model=&quot;selected&quot;&gt;&lt;&#x2F;select&gt; &lt;div ng-include=&quot;selected.template.url&quot; &#x2F;&gt; </code></pre> &gt; I hate the lack of CLI. I hate the ridiculous amount of shit I have to do to simply get a project started.<p>You can use the official Create React App CLI [1].<p>&gt; I hate the sheer amount of boilerplate code and the verbosity.<p>How do you recreate the following component in Ember&#x2F;Angular&#x2F;Backbone&#x2F;jQuery&#x2F;FoobarJs with less boilerplate and verbosity?<p><pre><code> Header.js: import React from &#x27;react&#x27;; import Icon from &#x27;.&#x2F;Icon&#x27;; export default ({ icon, title, subTitle }) =&gt; ( &lt;header&gt; &lt;h1&gt;&lt;Icon name={icon} &#x2F;&gt; {title}&lt;&#x2F;h1&gt; &lt;p&gt;{subTitle}&lt;&#x2F;p&gt; &lt;&#x2F;header&gt; ); </code></pre> &gt; I hate the lack of conventions — every project I look at looks different, every blog post looks different.<p>React is just a library to build views, so there is not a single way to build your app in the React world. You can use Redux, MobX, Flux or whatever you want to manage your data. You can even do it in 100% raw vanilla JS. I think it&#x27;s great.<p>---<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;facebookincubator&#x2F;create-react-app" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;facebookincubator&#x2F;create-react-app</a>
评论 #12797808 未加载
评论 #12797607 未加载
carsongross超过 8 年前
<i>Is React a fad?</i><p>Yes.<p><i>Is it here to stay?</i><p>Yes.<p><i>Should I get into it?</i><p>Depends on what you need. If you are building a web application with complicated UX needs (protip: you probably aren&#x27;t) and&#x2F;or the team insists on React, you probably need React. If you want an easy time getting a job in the Bay Area right now, you probably need React. If you want to avoid having your comments downvoted on HN, you probably need React.<p>So, it depends.
评论 #12798593 未加载
评论 #12797232 未加载
评论 #12799524 未加载
cbhl超过 8 年前
You are probably just experiencing change aversion, also known as &quot;getting older&quot;. It&#x27;s normal to have these feelings.<p>There were people who programmed in assembly and hated compilers and C. There were people who programmed in C and hated Perl. There were people who programmed in Perl and hated PHP. There were people who programmed in PHP and hated Ruby. There were people who programmed in Ruby and hated that JavaScript suddenly was a &quot;real&quot; programming language.<p>You&#x27;ll probably be able to find work in your language&#x2F;framework of choice for a long time, although as time progresses it will be less &quot;hip startup&quot; and more &quot;enterprise&quot; (look at C#&#x2F;ASP.NET) and &quot;banks&quot; (look at COBOL).
评论 #12799659 未加载
acconrad超过 8 年前
You&#x27;re not wrong in hating React, but it is a fad as much as no one wants to believe it. The reason I believe is because no matter how strong the framework, eventually it will be adopted (to some extent) into the native language (which is a good thing). Think about these frameworks:<p>- jQuery<p>- Coffeescript<p>- Backbone<p>at the time, if I had asked you if those were a fad, you&#x27;d think I was crazy. And yet, because of native language enhancements, none of those frameworks are really needed anymore. And I&#x27;m sure in 5 years React, Angular, Vue, Ember...you name it, will also likely be a thing of the past.<p>The important thing that I&#x27;ve learned in my (so far very short) career is that it&#x27;s always best to know the language first, and the framework second. Frameworks come and go, but the language is permanent. By knowing the language really well, it&#x27;s strengths and weaknesses, it enables you to determine when a framework is helpful...<i>and more importantly, when a framework is a hindrance</i>.<p>As an anecdotal example, I had a client that was using a React boilerplate on NPM to do a Foursquare API request. React is like, 50k lines uncompressed? To do <i>that</i>? I was able to replace it with 22 lines of vanilla JS. If you don&#x27;t know the base language, it&#x27;s often easier to simply think in the framework and create a bloated environment for very basic things rather than just use what the language gives you. It&#x27;s faster, it&#x27;s cleaner, it&#x27;s more widely supported in browsers, has a larger community, and is more defensible to use the base language than a framework, until the framework does more work to help you than harm you.<p>So my advice would be, if you&#x27;re thinking about using React or Angular, think about why you need it. Are you doing heavy lifting on the front-end, like interactive graphics or a dashboard? Sure, those are probably pretty good choices. If not, and you&#x27;re simply trying to make the front-end more RESTful, with some easier reasoning about your applications, you could probably get away with a lighter framework like Mithril, Elm, or another lightweight framework.
评论 #12798108 未加载
mariusc23超过 8 年前
I wasn&#x27;t a huge fan of JSX until I saw the template errors in Angular 2. Not trying to bash on the rest of Angular 2, but it really made me appreciate how JSX points out the exact syntax error at compile time. Pretty much all template based frameworks have the same problem.<p>It took a while for React to &quot;click&quot; for me, but that was mostly because of transitioning from MVC to Redux. I highly recommend learning pure React first. Build a project with that first, even if it seems like you&#x27;re writing a lot of code.
zghst超过 8 年前
<i>I recall a few years back I hated Ember JS and kept trying to get into it and hating it then for some reason the 3rd time I did, it stuck and I LOVED IT.</i><p>Seems like you&#x27;re already obstinant and opposed to tech from it&#x27;s perceived novelty and new age, rather than trying to understand the problems its trying to solve.
jameskilton超过 8 年前
What may help is to change your perspective, and to change your word choice.<p>It&#x27;s not hate. It&#x27;s <i>definitely</i> not hate. You don&#x27;t like React, and that&#x27;s perfectly fine. &quot;Hate&quot; has some very specific, very negative connotations that make almost impossible to have a regular conversation. One of my mentors uses the term &quot;stop words&quot;. Hate is on that list of words that, when used, stop the conversation in its tracks.<p>It&#x27;s ok to not like things. It&#x27;s perfectly OK to not like Javascript frameworks. There&#x27;s a ton of them, or you can write your own if you feel that&#x27;s necessary.<p>But please, can we stop throwing around the word &quot;hate&quot;? It does nobody any good and only furthers the problems of ego and exclusivity prevalent in our industry.
评论 #12797532 未加载
formula1超过 8 年前
The reasons why you should like react<p>- forces you into an object oriented paradigm with constructors&#x2F;destructors<p>- mutation from external sources and internal sources results in a single function being run to refresh the output.<p>- inline html&#x2F;xml is your freind. You can see easily how a ui is structured rather than parsing a 300 line file to see what gets created, destroyed, appended, prepended anD etc<p>- all jsx results in is a &quot;patch&quot;. This &quot;patch&quot; is then compiled into components (which also result in a &quot;patch&quot;) or html elements&#x2F;text&#x2F;null values. This makes reasoning about the application simpler since a &quot;controller&quot; component may not care about updating canvas info. But the &quot;canvas&quot; component certainly does
评论 #12798792 未加载
评论 #12799914 未加载
xiamx超过 8 年前
May be you should try it more than three times. Like you&#x27;ve experienced with ember and vim, the epiphany comes all of a sudden
评论 #12797246 未加载
raquo超过 8 年前
&gt; I hate html in javascript. I hate JSX.<p>How about hyperscript? Functionally equivalent to JSX but it&#x27;s pure JS, with no XML syntax.<p><pre><code> header( h1(Icon({name: icon}, [title]), p(subTitle) ) </code></pre> I don&#x27;t think you can make an argument against building the DOM in JS (instead of using some random DSL to parse HTML template strings) without falling into the fallacy that JS === logic and HTML === presentation. But, you don&#x27;t seem to be making arguments.
gremlinsinc超过 8 年前
Then don&#x27;t use it, imho Elm is way better, and the way they write html in elm is a lot more pleasing and less ugly than jsx. I&#x27;d recommend taking a look. It also compiles to js and has better performance.
评论 #12798667 未加载
zilchers超过 8 年前
I&#x27;m with you on the embedded HTML in JavaScript files. There&#x27;s a reason everyone went nuts for MVC, the seperation of UI code (in my opinion) just makes your life as a developer easier.
评论 #12800101 未加载
评论 #12798072 未加载
shahmeern超过 8 年前
I think that enjoying working in a framework&#x2F;library is very much a function of how familiar one is with the framework&#x2F;library.<p>It might be worth giving React that 3rd try.
busterarm超过 8 年前
I kind of feel this way about React, but I feel even more strongly this way about Ember.<p>For one thing, I haven&#x27;t been to a single React site that isn&#x27;t an absolute CPU hog. Facebook is the worst for this.<p>Besides that though, I feel like it&#x27;s still some intermediate step before we have something better.<p>I&#x27;m bullish on Elm though. For now, plain vanilla (but mostly functional) JS works fine for me and occasionally I&#x27;ll throw in Backbone&#x2F;Marionette where appropriate. Maybe that&#x27;s too boring for people, but I&#x27;m too busy being happy with a stable stack and making money to care.
fractalf超过 8 年前
Best thing I&#x27;ve read about react js ever! +1 Every time some person I talk to mention react, part of me want to vomit.