React is mostly hype
en.arguman.org
en.arguman.org
> React becomes counterproductive when developing apps that aren't mere demos.
I have developed big apps in Backbone, moving very the same apps to React and the productivity went up madly. Facebook does develop apps which certainly cannot be considered "mere demos" and you can see them in action, for example Ad Manager for Facebook on iOS (written in React Native). Facebook invests a lot in React development and there is a reason for that - they use it internally intensively.
> It's marketed to developers by billion dollar Facebook, a company historically intent on squashing startups.
This is not an argument at all. I would be really surprised that's the reason for React to exist. Also React is more a way of thinking, the library itself can be replaced if Facebook should enforce it on a successful startup.
> The utility gained by using React's ecosystem is significantly outweighed by its overhead.
This is certainly not my experience. React has very little overhead and from my experience it's pretty easy to grasp the concept for new developers.
I have no idea where does hate for React come from, it's >> just << an open source library and I wonder how people are willing to start flamewars about a few lines of code. If you don't like React, don't use it. There are a few alternatives like Ember, Angular or even Backbone (although I would say Backbone deserves much more hate than React).
And yes, React is as much a technique for building UI as it is a particular implementation. Learning and using React has also improved the iOS code I write.
I use it at work on a page-by-page basis-- it drastically reduces the mental overhead of class naming, JQuery spaghetti, maintaining the DOM etc. Sometimes I even surprise myself when something "just works" because of React's well-controlled model.
This is Reacts greatest strength and a huge design constraint they had from day one. On the other hand it's a tradeoff and as everyone mentioned not having the whole stack under "one roof" brings a lot of tedious crap.
If you need something to incrementally rewrite parts of your frontend React would probably the best choice. If you need something to start your project on I'd consider other options, Angular 2 and Aurelia for example.
Back in the day, jQuery was amazing because it made selecting and manipulating DOM elements easy. But now, plain JS has mostly caught up to that functionality, to the point that it rarely makes sense to use jQuery over plain JS. I wonder if in a few years the same will be true of much of the functionality in react.
We're moving closer to having real GUIs in the browser (e.g., Java Swing) but that's not a function of the language, but the plumbing around the language. Swing isn't Java, Swing is written in Java.
But again, JS is just a language, that happens to have an interface into a DOM (in some environments). It's not a framework that guides you in how to organize and architect an app.
It's possible to write maintainable, high-performance, complex apps using plain JS. Adding a few simple layers makes it a lot easier, though, and I'd argue that the current crop of client-side frameworks make it easier still. Simple apps == simple code. Complex apps == complex code, regardless of the tools used to create it. Underneath everything, after all, is still just plain JS.
For an app of any reasonable complexity you'll have "architectural overhead" whether or not you're using your architecture or someone else's. That's just a given. (And if you don't, you have more overhead trying to figure out what you were doing.)
More complex build process? Yep, if you're not writing all the code yourself, and you want to distribute a single file, and ES2015 (or other) transpilation, and minification, sure. But you can use all the libraries in question without much of a build process at all, just load 'em all up and use ES5.
Complex build processes are a result of wanting to distribute and write code in a certain way. They're not a requirement.
Before with libraries like jQuery every potential action had to perform it's own UI modifications.
As the projects grows you have the same UI element being controlled from many different sections of code. States and state transitions not clearly defined.
With React you set the state and the UI will always match, no matter how the current state was achieved.
The purpose was to get rid of ad-hoc DOM manipulations.
The Flux architecture just takes this a bit further by formally defining who holds onto the state/how it's accessed (stores) and the availible possible state changes (actions).
jQuery was all about selecting a node or node list and then applying manipulations to it.
Never ever have I seen active encouragement of poor programming discipline. You are correct in that's what jQuery was about, but it had no opinion on how to go about that task.
By having the central unit of work start with a query selector is one such influence which I feel implicitly encouraged DOM manipulations.
Taking a look at the original jQuery website on web.archive, this is the introduction to the $() function:
"The functionality of jQuery centers around one central function: $(). Everything in jQuery is based upon this, or uses this in some way. The most basic use of this function is to pass in an expression (usually consisting of CSS or XPath), which then finds all matching elements and remembers them for later use. For example:"
And then goes to show a DOM selection followed by a chained mutation.
That's jQuery's primary job. It isn't DOM manipulation that causes code/architectural issues.
"All" (I'm simplifying) jQuery does is provide mechanisms to select and manipulate DOM. How to organize its usage is an exercise left to the reader, and most readers did it poorly.
It's not jQuery's fault that people wrote shitty code with it. And, in fairness, when Prototype/jQuery/etc. came out, sites were simpler. When people started doing more, if they didn't take control of how they were using jQ/etc., it blew up and made them hate their lives.
At the same time people were doing that, other people were using various organizing principles to tame their jQ/etc. soup, writing tests, and keeping a handle on the sprawl.
You can write shitty code in React, too. It imposes a certain set of conventions that make it harder to want to. Layer on Redux/etc. and it's even harder to want to. Layer on other various conventions and frameworks and you want to even less. But it doesn't stop you--just like jQ didn't stop you from using self-discipline before people smarter than me evolved client-side frameworks to where we are now.
While I wrote my share of jQ soup, I also worked on projects that were flexible, extensible, testable, and clean. The choice is always ours to make.
Of course you can architect those flexible, extensible, testable and clean projects. But straight out of the box you do not get that with jQuery. It requires planning and architecture engineering.
Whereas every React project starts off with those principals.
In other words, the ways people can use jQuery wrong is worse than the ways people can use React wrong.
None of this is related to what I said originally, which is that jQuery doesn't encourage shitty code. jQ's original purpose wasn't to organize developer activity, it was to simplify one tiny portion of it.
> [Good code in jQ] requires planning and architecture engineering.
Precisely what I said.
(That said, if you don't do that with React, you'll still end up with a mess.)
My point about planning and architecture was to contrast it against what I believe React is better at.
Personally I think React is easier to understand. Honestly the vDom is an implementation detail people get stuck on. Pure functions, well defined state owneeship and transition, and so on are the real benefits.
The other main criticism is JSX which is totally optional and mixing implementing with presentation; the "correct" which I believe to be a outdated but still accepted belief that went out of style around Web 2.0. This separation is not required either, you can rewrite render() to pull from any templating engine or whatever. Or use HOF/HOC via the presentation/containener design pattern.
I realize I went off topic but I've been wanting to compiler my thoughts on this.
I like JSX quite a bit as well; IMO creating an artificial separation between presentation and behavior is not a useful way to think about web apps.
Separating data from presentation and behavior is fine, and is a long-standing GUI tradition.
I would say JSX and the separation of presentation / behavior is orthogonal.
JSX is just a Javascript powered embedded SGML-like document.
The combining of presentation and behavior is caused by render() being defined inline with implementation.
You can not use JSX by using ReactDOM directly or a templating library while still keeping render() inlined.
Or you can move render() to another class (or subclassed, or HOC, whatever) and separate the presentation and behavior with or without JSX.
Redux is very core concept. You'll have to rewrite half of an application, unless you use it from the start. Routing is essential for any serious web site, so you have to implement it one way or another, and not using working libraries looks strange. Same about babel — either use it from the start or rewrite half of code later (or have a mess). Also I think that babel currently the way to process JSX, so unless you avoiding JSX (which would be very strange), you have to use it anyway.
I don't agree, that you can avoid all this stuff, unless you are just learning on throwaway pet projects or willing to reimplement a lot of things which are already have good enough implementation.
A full frontend stack is total overkill for the vast majority of projects that fall under the "open, check, close" use case. So many of the perks of those frontend stacks, such as keeping data in the browser and only reloading certain parts are based on the slow load times of a full frontend stack if you don't do all of those things.
Being able to use pure React both client and server side without anything else is a fairly significant perk.
Redux is something you can implement yourself easily, I never understood the need for a library there.
The good idea of redux is to have a serialisable state which is changed through events. This gives you unidirectional data-flow and the ability to pause/restore your application.
Complete immutability and funneling everything through functions on the other hand often just obscures readability, and, in case you are using immutablejs, gives you terrible performance.
If I want to have purely functional programs I don't use Javascript, but Haskell or something. If I need time-travelling debugging, which I never found very useful when dealing with complex states, I'll implement it by copying my state using serialization.
I think most developers (at least seasoned ones), come to appreciate tools as a solution to the problems that they solve.
There's always going to be a vocal minority that is strongly against whatever has the most hype at any given moment. Their reasoning is probably as varied as the people themselves, and a some of the criticism may be valid, but this is the nature of developer culture.
Having both groups is probably a net positive.
That patent license they have in their project basically means you can only use React as dev in a company if your company does not have patents or noteworthy IP.
https://mobile.twitter.com/paul_irish/status/754864479460929...
Here is the relevant section from the PATENTS file:
if Facebook or any of its subsidiaries or corporate affiliates files a lawsuit alleging patent infringement against you in the first instance, and you respond by filing a patent infringement counterclaim in that lawsuit against that party that is unrelated to the Software, the license granted hereunder will not terminated under section (i) of this paragraph due to such counterclaim.
It is an opinion held by many (many here) that Software Patents bring no value to the community and need to be abolished. I agree with them, and hence I disagree with you. I did not down vote you.
I also just don't understand statements like these. React is used by very smart engineers at Netflix, Uber, Lyft, Airbnb, etc and a ton of startups. It's well documented by these people that using React has been a productivity boost and they love it.
I know "argument by authority" but come on, you can't just say "React is bad for real apps!!!" when this list[1] exists.
[1] https://github.com/facebook/react/wiki/Sites-Using-React
Until React I dreaded front end development, painful, weird, quirky, hard to organise and generally problemtic. With React I feel like a front end guru.
AngularJS felt like some sort of weird computer science project developed by Phd's who had spent their university days studying Java - it hurt to learn it.
Call me a hipster fanboy if you want but I choose technology to work with because it is easy and make sense. I don't have much time so I have to commit my limited resource to the optimum set of technologies. At the front end that is React.
With Angular, you're basically having to learn an entirely new MVC framework, complete with a mess of its own methods and definitions, which is built on an already existing MVC framework (a web browser).
When I took some time maybe four years ago or so to study Angular, I came to the conclusion that it's just the wrong way to go about web development. I started thinking hell, I'm just gonna write my own library which strictly handles the view portion. Low and behold, I find React, and it's everything I was hoping for.
If anyone is thinking about trying out Angular, save yourself time and headaches and use React or Vue.js
Even more than with React, because they both felt much more full featured.
But yes they were harder to grasp than React and I prefer the tiny API of React over that convult that ExtJS is. And yes, I prefer JS-as-templates over that whole HTMLBars stuff Ember throws at their devs.
-Two-way binding in all cases is slow
-Directives are unecessarily hard to write
-Angular's default DI model breaks on alpha conversion, the basis of every JS minifier ever. All the fixes are cumbersome.
-The system is poorly documented, making it hard for a dev to get started.
-The system is overly complex, slow, and hard to debug ($digest already in progress, anyone?).
-But most importantly, it implements stuff that has no buisiness being in an SPA web framework. It re-implements scoping, modules, part of JQuery, DI, and a programming language, complete with parser.
React, however, did the responsible thing, and stuck to a specific domain. Even if nothing else React did was good (and I have some arguments there), this is a major win over Angular.
And no, a depgraph doesn't make it fast. What can make it fast is firing less events, using better triggers, and basically handling it exactly the way that Angular didn't.
VDOM can help, but really not much. However you want to put it, two-way binding is costly, and it should be avoided whenever possible, or minimized by catching multiple bind events at a higher up element on the tree (see http://lhorie.github.io/mithril-blog/asymmetrical-data-bindi...)
Just spraying it everywhere, the way Angular encourages, with no optimization (like the aforementioned asymetrical bindings), should be considered an antipattern.
In any case, Computed values make 2 way binding more expensive, because you have to run a depgraph on all the vars that are part of the binding network, every time an event fires. This is O(n). This is only one reason why Computed Values, as implemented in JS, are a Bad Idea. If you have to update a var on event fire, okay, but leaving the things everywhere is slow and ungainly. If you instead change the var to a function call, you can optimize far better, because you only have to update when the value is read.
In conclusion, if you want to polymorphism between functions and variables, treat everything as a function, not as a variable.
At least, I think that's a response to your question. Your English is pretty broken, so it's hard to tell. Sorry.
It's easy enough to write two way binding into a react state variable, it's just nice to not have it happen by default since having state able to change anywhere in the app can get confusing.
http://blog.ractivejs.org/posts/whats-the-difference-between...
Heck, it's like a Pythonista would go comparing Django and Jinja. One's a framework, another's a template library. Same goes for Angular and React - Angular's a framework that tries to be do-it-all solution (UI rendering, validation, data model description, data persistence and communications with server, and more), React's an long-distant ancestor of templating libraries that essentially does only one thing - takes a data structure, a component definition and renders (and maintains) a DOM tree.
Seems that many are calling non-React pieces that are frequently used with React (e.g. Redux, Flux, Immutable.js, Restful.js) to be "React" as well, while they don't seem have any ties to it.
But, yea, loose coupling's great. And React is a very nice library.
> It's marketed to developers by billion dollar Facebook, a company historically intent on squashing startups.
This is a poisoning the well fallacy.
> The benefits of using a virtual DOM over the actual DOM are theoretical at best. The problems that React supposedly solves are theoretical at best.
This "argument" contains zero information.
> That's why there's Redux!
Redux and react don't solve the same problem.
> It solves problems you'll never encounter because you don't have Facebook scale.
The client doesn't scale like the backend. Not to mention it's in contradiction with this other "argument":
> React becomes counterproductive when developing apps that aren't mere demos.
Do people actually take this serious?
React isn't for scale. And it isn't to side step learning about html and css. It's main reason for existence is to make complex UIs easy to manage.
Pretty much the only argument I can think of against React is that it's a boil-the-ocean system.
Once you start doing your UI with it, you pretty much need to make the entire thing use react to really benefit from its model. Having different interlinked components mixed between react and query and what-not is asking for trouble.
But. Building your UI as a description of your current state is so incredibly useful to reason about and prevent bugs, that it's usually worth it to go completely into the system.
The only other major gripe I have is getting time-based elements like animations to play well within the system.
In my experience React is quite ideal for cases where some parts of a site or an app need dynamic behavior. I'm currently working on an e-commerce platform's admin panel, and for us a complete rewrite would have been nearly impossible. With React we can keep the old HTML + jQuery codebase, and implement/refactor stuff as small or as big as we need (e.g. a live-search component or a whole new dashboard view). We're doing something very similar to this: https://github.com/reactjs/react-rails#rendering--mounting
But that works if the various existing components on the page don't have strong multi-directional data flows between them. At least that's what I've experienced.
This seems to be a central point that the "I can just do this in CSS/HTML/JS" crowd continually misses. It really doesn't matter that you can do it... It matters that you can dynamically compose your work with hundreds of other people.
IMHO, most expert devs don't meet this bar with pure web tech, but unlike the W3C, I don't blame the webdev for poorly composing solutions, I blame the web standards themselves for poorly defined compositional properties.
But the platform has at least risen to the level where we can define its behavior ourselves. So I think it's healthy for other sources to push innovation because React upped the ante for Web Components and Web Assembly. The W3C will eventually understand the need for composition and isolation at scale, but they would have taken a lot longer to recognize the use-case without a competing concept like React.
The exact opposite is true. The whole point of React is in building complex UIs.
> React becomes counterproductive when developing apps that aren't mere demos.
A few sites using React that are not mere demos:
> It's marketed to developers by billion dollar Facebook, a company historically intent on squashing startups.
Except when they are buying them for billions (WhatsApp, Instagram, Oculus). All things being equal, Facebook is probably more likely to buy your startup if you use React.
But the claim and current consensus around web development is that "you should absolutely use a framework built by someone smarter than you or you'll end up shooting yourself in the foot" I find equally ill-informed.
Consider these popular libs and then consider how poorly they integrate with each other: jquery, bootstrap, require and knockout. If you are off by a version or two in jquery, then bootstrap will not work. Up the version of jquery and parts of your app will break down. Try to fit libs that aren't modularized or that use hard-coded deps with require. You'll end up rewriting those libs (to get rid of deps you don't need).
I feel javascript should be mature enough to use without frameworks. Remember the cutting-and-pasting of the javascript.com era? We're back to that, I feel. I mean, surely there are lots of smart snippets of code or even libs that you want to use in react but can't because the code-snippets or libs aren't following the react architecture. What do you do then? Cut-and-paste those parts that you need and that will fit into react, perhaps?
The post is bait-and-switch, react is a bite, time for a switch. :-)
Some day we may have a forum (in the broadest sense) that uses a sensor, like a webcam, and "emotion recognition" AI. You are not allowed to vote if you are too worked up about a comment, and if you post it will be held for a few hours and you have to acknowledge that you still mean it after that "timeout" period before it gets published. This should/could take care of some hot-headed responses. I think digital discussion needs more ideas, just "post your comment here" and "votes" don't really cut it. It's better than nothing (pre-Internet), but we've seen the disadvantages by now, why not try something new?
Internet discussion and collaboration software could be (should be?) the most exciting thing, instead everybody just copied and barely modifies the core concept in use since the very first web forum software was first published.
http://en.arguman.org/fusion-is-just-a-cheap-tactic-to-make-...
I can see it being replaced by another library with a similar underlying philosophy that just does it better, but I don't really see how the general idea would vanish soon.
And btw Facebook uses it a lot on the web too (not just the often mentioned Ad Manager), messaging (and messenger.com) is basically all React and other components are a mix. Download the React Devtool to check it out, they don't obfuscate the React tree at all. Pretty fun to browse.
However, the ecosystem, not just React but the npm ecosystem in general, has been a bit disappointing. Things move very quickly in some places but not others. React itself has broken or generated warnings numerous third party packages that, hopefully, will catch up. It's disappointing because it basically forces us to not update our main dependencies until everything has moved with it. Perhaps that's my fault for placing the npm/js world on a pedestal, but then again, I think I've only done that because, while .NET is generally favorable today, the inertia of past criticisms had led me to believe that the .NET ecosystem was somehow inherently deficient or broken when compared to the JS ecosystem. At this point, they seem fairly similar in terms of quality and choice.
One big plus with moving to any npm-centric development is that, coupled to a move to Windows 10 and using bash, a lot of the dev workflow has moved out of, say, Visual Studio and into a command line. This is great because as we move build and deployment configurations between machines and tools (say to Jenkins), there aren't lots of details hidden in our project and solution files. It offers a clarity I didn't know I wanted.
I'm a frontend engineer, and I greatly enjoy working with React. But I think that's because I've invested the time needed to learn and navigate the ecosystem.
It's true that React doesn't solve all the problems you deal with when building a web app. But I don't think it has ever marketed itself as a "batteries included" solution. It gives you a strong ecosystem and a great abstraction for building UI's.
TruthyOne, if you really believe all this and are submitting it to Hacker News, surely you wouldn't mind sharing how you've come to these conclusions?
Shameless plug, but we did wrote an article outlining our experiences at https://blog.alarisprime.com/e-commerce-case-study-building-...
React is _just one framework_. Popular, sure, and occasionally annoying (for very small things, the overhead of building a gigantic workspace vs just using Zepto and ending up with three JS files is... well... pointless), but we should be looking at the broader picture.
Part of seems to be: "How dare people not like the tool I prefer", or simply that people don't want to be bothered to learn yet another JavaScript library (which I can understand, but I'm not being prevented from using the tools I like, just because React exists).
One "mistake" I see React make, others do too, is mixing JavaScript and HTML. I'm still firmly in the camp that believes in progressive enhancement as the correct way of developing for the web. React, Angular and most other modern libraries doesn't seem to share that view.
Assuming you want to write an app in C++ that doesn't need it, and are comfortable with not having any of Electron's sandboxing features. While JS isn't my preferred language, it does beat doing everything in native code with full filesystem access.
Not really. Besides, React has nothing to do with Electron.
I am into software development, and I use React daily for frontend-applications. While I'm not swooned as much as most people, I still thinks it has great value.
I liken it the Lisp macro analogy. Never write an SPA unless absolutely necessary--stick with a web page with some dynamic js-driven features as needed.
- Having to figure out babel, browserify and/or webpack before you can write hello world isn't a great first experience. I'm glad to see much of this has been moved to a separate page outside of the getting started guide now.
- The main React page emphasises that JSX is optional. Even looking at the trivial examples, nesting createElement statements looks horrific. Does anyone use this approach in a large-scale project? If your components are fine-grained enough, perhaps it's passable, but it looks far from ideal. Having used other frameworks, even building up a template in JSX in a return statement feels dirty. I see there are some suggestions around on splitting out JSX, but it would be great if this was the default.
- I wasn't really sure what to do with CSS. There's a brief comment on inline-styles at https://facebook.github.io/react/tips/inline-styles.html. For a library for building user interfaces, it seems like this deserves more attention. I would've expected the CSS (styling), javascript (logic and state management) and JSX (layout) to be a little less interwoven.
There are like 3 or 4 different ways of doing it, each with their own pretty big drawbacks.
Personally we ended up using CSS Modules with SASS in our "main" react project, but it feels clunky.
The biggest issue we have is determining which element "owns" the styling. Should a widget style itself, or should it let it's container style it, or should it provide some simple defaults and let the container overwrite them (which gets ugly because with CSS Modules overwriting means using !important or doubling classes (like `.button.button` to overwrite `.button`).
All that being said, it's actually working out really well for us despite feeling wrong. And it might not ever become an issue because our largest stylesheet is like 100 lines long since everything is so compartmentalized.
1. In terms of best practices, React for serious development is a disaster just by itself. Read on.. This is what happened in my first project (when I didn't use Redux). By itself it is only good(and great) for POCs. And React-ecosystem is complex to start with. React-Redux, Router, Axios, Webpack make React complete for use in any serious project.
2. React makes web-componenting pretty easy. However it is counter-intuitive when you start thinking about the all important Smart Vs Dumb components separation. I don't know about others, but I like to see components as behaviour-complete stuff and not just view-complete. React with its ecosystem does things in a view-complete way. Yes, it does result in much much lesser bugs.
3. React is hyped because of its simple examples. As I said earlier, it makes it easier to create behaviour-complete web components. But then the ecosystem says "NO. NO.. Think in REACT way". That is not wrong but its complex. The first project in React was a disaster because of the complex state management I did without using redux or flux.
4. After working with React - when I tried Angular2, I moved back to React again. And I did React+TypeScript which makes coding even easier. The only thing I still like in Angular2 is now-not-default two-way data binding.
Do I love React? May be not so much - but its the best I have seen. But I love the way my apps remain bug free without a lot of front-end testing code. And once you add TypeScript, development is just a bit more easier and bugs get thrown up at compile/transpile time
- No quick submit + signup/in button
Which is why I guess people rather argue here than on the site (says something if the whole point of the site is to make arguing easier)
Closest I've found is Vue but it was still 20-30% slower than React, according to the DOM speed test on a benchmarking site.
edit: developed and backed by the awesome guys at The Guardian newspaper.
I better get to work on my actual project so I'm not overtaken :/
"Your license to use React.js can be revoked if you compete with Facebook"
http://react-etc.net/entry/your-license-to-use-react-js-can-...
This is the scariest part to me:
"The library is open sourced under BSD, but it comes with an added patent clause that you should be aware of."
https://github.com/facebook/react/blob/master/PATENTS
From reading more, it appears that Facebook can just terminate your right to use their patents, but not React. However, it isn't clear to me what is patented and what rights you lose.
Related past discussions here:
https://news.ycombinator.com/item?id=9271331
https://news.ycombinator.com/item?id=11270213
On the bright side, it's said that Apple and Google are ok with the latest version:
https://github.com/facebook/react/pull/3554#issuecomment-235...
This is a Mutually Assured Destruction clause for patent fights, nothing more.
So you can compete with FB without losing a license. The first blog post you quoted shows a misunderstanding of the license (the word "compete" doesn't show up in the license).
So the correct representation is "If you claim patent infringement by FB, you can lose the license.". This is what the linked comments say, but what your summarised statement didn't properly capture (hence my comment).