News for hackers. Stuff that matters.
Re:Why is React is taking over front-end development? by robotnoises on Wednesday May 10, 2017 @09:40AM (#14308054)
"React is just JavaScript, there is a very small API to learn, just a few functions and how to use them. After that, your JavaScript skills are what make you a better React developer. There are no barriers to entry. A JavaScript developer can become a productive React developer in a few hours."

To me, this is the major driver of React's adoption and thus its success. Angular 1 took me a while to grok because there were so many moving parts. React's API is small and consistent a la JQuery, with the added bonus of being incredibly powerful.

Re:Why is React is taking over front-end development? by boubiyeah on Wednesday May 10, 2017 @09:59AM (#14308207)
I've never seen someone being productive with react in a few hours, unless we're talking about very basic, static layouts.

Stateful components are still hard to write (but are useful!).

Component lifecycle is not trivial and has many traps.

Newcomers put the craziest things in render(): side effects, etc. JS or even TS has no way to enforce that render should just return a VNode and do nothing else.

Data management is very, very difficult (beginners use props and state interchangeably).

Using higher order components or generally writing reusable components with clean APIs is an art in itself.

Separation of concerns in React is tricky too, as the community like to say "everything is a component" and this again has many traps.

The concept of keys or in general, when a node is reused vs when it's destroyed/recreated is not easily understood by newcomers too. But you HAVE to understand that to do animations, etc.

Also, you're productive if you don't care about performances; Once you do, you will be much slower. shouldComponentUpdate, using immutable updates everywhere, not creating lambdas everywhere on each render (idiomatic react), using virtualized lists, etc.

Let's not pretend React is very easy. It only is fairly easy if you compare it to something extremely bloated like angular.

Re:Why is React is taking over front-end development? by tchaffee on Wednesday May 10, 2017 @10:15AM (#14308312)
I guess it depends on what you mean by productive. I completed the React official tutorial in less than an hour and started writing a simple app, which then grew to a more complex app. Component lifecycle was trivial to me. There are only five or six lifecycle hooks. I was answering React Stackoverflow questions within a few weeks of starting.

Does React have some gotchas? Yes, but most of the time devs who get caught by those simply haven't read the very short and very good docs.

I've used loads of frameworks in my long programming career and React has been one of the easiest to pick up. Agreed that Angular is a bit of a nightmare. I studied that for months and still feel like a beginner even after building a side project with it.

Re:Why is React is taking over front-end development? by barrystaes on Wednesday May 10, 2017 @10:27AM (#14308424)
I argue that React is only difficult because you have to unlearn a lot of bad "tricks". For me the hard part to learn was JS..

I only started JS development because React enables me to build UI software like i always have done, except now in a browser.

React is components 101 for use in browsers. Flux is business logic 101.

Both (React/Flux) are great for devs that have no prior experience with building normal desktop applications. And ideal for devs that DO have that experience. That is where the (non-early) adoption wave is comming from imho.

Re:Why is React is taking over front-end development? by robotnoises on Wednesday May 10, 2017 @10:11AM (#14308290)
Productive as in "has produced something." I agree with bulk of what you're saying here, but my point was about barrier to entry, not being good or even great at it.
Re:Why is React is taking over front-end development? by boubiyeah on Wednesday May 10, 2017 @10:14AM (#14308311)
I suspected you meant that.

Just wanted to add some additional infos :p

Re:Why is React is taking over front-end development? by robotnoises on Wednesday May 10, 2017 @10:19AM (#14308349)
It's fair to point out, considering that the general attitude towards React is that it's some panacea of simplicity, shining down from atop the mountain upon the unwashed masses. We still need developers in this world. :)
Re:Why is React is taking over front-end development? by nickthemagicman on Wednesday May 10, 2017 @10:08AM (#14308270)
Thanks for clarifying. Parents comment was a little extreme. Also you have to include learning the front end ecosystem, webpack, Commons vs the other one, all the transpilation, react architecture which is diff from Js/jquery and even get into the.fluxes.

Jeff not a few hours.

Re:Why is React is taking over front-end development? by sheeshkebab on Wednesday May 10, 2017 @10:16AM (#14308329)
Let's not kid ourselves - React is not jquery, by a long stretch. There is a reason why react developers can charge $100hr+ to do things effectively with react.

"Hello world" in react is deceptively easy, that is true.

Re:Why is React is taking over front-end development? by robodale on Wednesday May 10, 2017 @09:31AM (#14307988)
I'd argue Vuejs is rocketing toward Reacts leadership position: https://trends.google.com/trends/explore?q=reactjs,vuejs
Re:Why is React is taking over front-end development? by mulrian on Wednesday May 10, 2017 @09:40AM (#14308049)
Re:Why is React is taking over front-end development? by rmccoy6435 on Wednesday May 10, 2017 @10:20AM (#14308361)
I'm not sure I wholeheartedly agree with that. The YouTube channel "REACT" could be driving some of these numbers. There's a spike in early 2016 that made me think of it - remember the whole 'REACT' Trademark craze? The Stackoverflow Trends blog post [0] from yesterday is probably more representative.

https://stackoverflow.blog/2017/05/09/introducing-stack-over...

Re:Why is React is taking over front-end development? by Kurtz79 on Wednesday May 10, 2017 @10:50AM (#14308629)
Try changing the timescale to 3 months or so for react, you get a nearly perfect pulse wave with peaks on weekdays and valleys on the weekends.

The same happens with Javascript, Java and I guess most (popular) programming languages; it might be an imperfect indicator, but one that suggests people are actively searching during their working hours (which I don't think applies to the youtube channel).

Re:Why is React is taking over front-end development? by mulrian on Wednesday May 10, 2017 @11:04AM (#14308719)
It's maybe not perfect, but definitely a lot better than 'Reactjs'. You just have to look at this topic - how many people just say React vs ReactJs. Besides Google seems to know that I'm wanting the JS framework so hopefully its filtering out some of the other unrelated 'React' stuff.
Re:Why is React is taking over front-end development? by SamBam on Wednesday May 10, 2017 @09:53AM (#14308162)
Absolutely. The line before 2014 represents the tiny baseline of people using "React" in other contexts. The entirety of the growth since then is the Javascript library.
Re:Why is React is taking over front-end development? by bpicolo on Wednesday May 10, 2017 @10:49AM (#14308620)
I mean, if you're going that far: https://trends.google.com/trends/explore?q=%2Fm%2F012l1vxv,v...

Oh look, `Vue` is contaminated by things like PS Vue, just like `react`.

Re:Why is React is taking over front-end development? by SamBam on Wednesday May 10, 2017 @02:02PM (#14310216)
Since your line for "Vue" shows no increase in usage after Vue.js came out, while the line for "React" does, I'm not sure this shows what you think it does.
Re:Why is React is taking over front-end development? by dberhane on Wednesday May 10, 2017 @09:43AM (#14308084)
Another perspective from Stack Overflow Trends: https://insights.stackoverflow.com/trends?tags=vue.js%2Creac...
Re:Why is React is taking over front-end development? by enraged_camel on Wednesday May 10, 2017 @09:57AM (#14308190)
Vuejs is very good, and I like it a lot more than React. However, it is difficult to see it ever becoming more popular than React, when the latter is evangelized by a large and well-known software company.
Re:Why is React is taking over front-end development? by malikNF on Wednesday May 10, 2017 @10:08AM (#14308268)
>is evangelized by a large and well-known software company

This company is the exact reason why I want Vue to succeed.

Re:Why is React is taking over front-end development? by Gaelan on Wednesday May 10, 2017 @10:23AM (#14308393)
Why? I'm not an FB fan either, but your use of React does not benefit them in any way.
Re:Why is React is taking over front-end development? by owebmaster on Wednesday May 10, 2017 @04:01PM (#14311135)
It indeed benefits them in a lot of ways otherwise it would not be open source (with an IP part).
Re:Why is React is taking over front-end development? by darkerside on Wednesday May 10, 2017 @12:15PM (#14309373)
I thought the same thing, but later learned that JQuery, built by an independent developer, ended up triumphing over Prototype.js, backed by a larger organization.
Re:Why is React is taking over front-end development? by boubiyeah on Wednesday May 10, 2017 @12:12PM (#14309337)
Yes. The react ecosystem has a massive communication advantage.
Re:Why is React is taking over front-end development? by robodale on Wednesday May 10, 2017 @09:33AM (#14308003)
Also (as mentioned by others as well...) Should we be really talking about how Angular dominates? https://trends.google.com/trends/explore?q=reactjs,vuejs,%2F...
Re:Why is React is taking over front-end development? by maelito on Wednesday May 10, 2017 @09:41AM (#14308066)
Re:Why is React is taking over front-end development? by epmatsw on Wednesday May 10, 2017 @10:22AM (#14308392)
That actually is pretty fascinating. Even with the fix from above, Angular has a pretty decent lead: https://trends.google.com/trends/explore?q=%2Fm%2F012l1vxv,v...
Re:Why is React is taking over front-end development? by maelito on Wednesday May 10, 2017 @09:39AM (#14308041)
Isn't it misleading to use 'ReactJs' in google trends ? You won't find 'ReactJs' on React's homepage, but 'React' whereas you'll find 'AngularJs' and 'VueJs' everywhere on their respective home.
Re:Why is React is taking over front-end development? by Kiro on Wednesday May 10, 2017 @10:19AM (#14308358)
How is Vue different from Angular 1? It looks and feels very similar. Granted, I haven't built very large applications but I'm using it in production and I don't really see the benefit while React has a completely different take.
Re:Why is React is taking over front-end development? by cholantesh on Wednesday May 10, 2017 @11:33AM (#14308943)
Vue took inspiration from both React and Angular 1. Syntactically, yes, it's quite close to A1, but it makes use of a virtual DOM and components, as React does.
Re:Why is React is taking over front-end development? by j_m_b on Wednesday May 10, 2017 @10:14AM (#14308308)
> React is a JavaScript library. It’s not a framework.

This is an extension of the UNIX philosophy: do one thing, right. React developers state that "React is the V in the MVP model". React can easily be integrated with any other JS library that is out there. This is very attractive to developers.

Facebook in general seems to be moving in the functional programming direction with tools like GraphQL. React is a functional approach to UI development. It also makes use of the concept of immutable data. The functional programming paradigm has been gaining traction lately and React seems to be riding along with this wave.

As React is functional, simple and makes use of immutable data, it was quickly adopted by the Clojure community. It has two major adaptations, React and Om. I imagine other functional programming groups have gone in a similar direction. This also could be helping propel it along.

Re:Why is React is taking over front-end development? by crimsonalucard on Wednesday May 10, 2017 @10:33AM (#14308488)
Does the unix philosophy require web pack and a complex compiler tool chain to get it to work? Is Compiling one language into another part of the philosophy as well?

React is not functional.

Re:Why is React is taking over front-end development? by j_m_b on Wednesday May 10, 2017 @11:10AM (#14308763)
>Does the unix philosophy require web pack and a complex compiler tool chain to get it to work? Is Compiling one language into another part of the philosophy as well?

In terms of the GNU system, they usually require autotools, make, gcc and binutils to compile. The code is translated along the way into a binary that matches the local format, such as ELF or Mach-O.

Re:Why is React is taking over front-end development? by ChrisCinelli on Wednesday May 10, 2017 @10:41AM (#14308541)
React came with a nice and small interface that work well with the DOM. It was pretty innovative and solved one of the biggest pain points.

I agree that because it just works on the View, it has been easy for people to adopt it.

The support of Facebook helped to make it shine in the "a new frontend framework a month" reality. Now the great documentation, great articles and great component already built for you make React a very compelling piece of software to use.

At the same time I agree with who says that today if we look only at the simplicity of the interface and performance, there are a few better libraries.

MarkoJs and Vue for example.

Re:Why is React is taking over front-end development? by seangates on Wednesday May 10, 2017 @12:20PM (#14309408)
+1 for MarkoJS. Approachable, isomorphic, stateful, and FAST.
Re:Why is React is taking over front-end development? by hjnilsson on Wednesday May 10, 2017 @09:30AM (#14307980)
Is it? Google Trends shows about twice the interest for Angular vs React [1], which is not an insignificant difference. Is there strong evidence to indicate that React is 'taking over'?

[1] https://trends.google.com/trends/explore?q=%2Fm%2F0j45p7w,%2...

Re:Why is React is taking over front-end development? by skeeterbug on Wednesday May 10, 2017 @09:40AM (#14308058)
If you have a simple, well documented library, is there a reason to search on it as often?
Re:Why is React is taking over front-end development? by robotnoises on Wednesday May 10, 2017 @09:47AM (#14308108)
That's a fair point. ng1's docs were somewhat lacking, too, which I reckon drove a ton of traffic to sites like Stack Overflow and Google in general.
Re:Why is React is taking over front-end development? by reboog711 on Wednesday May 10, 2017 @09:48AM (#14308115)
Search for UI Developer job with a distributed / remote team; and React jobs are significantly easier to come by.

Granted, by limiting to distributed / remote teams may not be indicative of the whole market.

Re:Why is React is taking over front-end development? by nilved on Wednesday May 10, 2017 @09:37AM (#14308030)
A lot of those posts are probably "Angular is dead" or "React is better than Angular"
Re:Why is React is taking over front-end development? by hypercluster on Wednesday May 10, 2017 @10:50AM (#14308628)
Okay I go ahead and say it: I still like Angular 1.x

I feel like there's a lot of hate towards Angular and much praise for React. Personally I don't get along with the syntax and just the readability of React code or rather the structure. But that may just be my lack of experience with it.

I understand that the DOM diffing in React is superior but.. is it really that important? For me the two-way data binding of Angular takes away the headaches of doing updates with jQuery. Sure, I get that having to follow the "Angular" way and wrapping foreign libraries is overhead. But it still feels adequately simple to write applications with it.

Re:Why is React is taking over front-end development? by samsonradu on Wednesday May 10, 2017 @10:00AM (#14308214)
> React is just JavaScript, there is a very small API to learn, just a few functions and how to use them. After that, your JavaScript skills are what make you a better React developer. There are no barriers to entry. A JavaScript developer can become a productive React developer in a few hours.

This is a valid point. Maybe not a few hours but it clicks with developers after a few days. But then there is also the very good documentation and an already big community. Also Facebook backing it is encouraging for mid-sized companies to use, which don't expect breaking changes any time soon.

Re:Why is React is taking over front-end development? by hyperpallium on Wednesday May 10, 2017 @09:45AM (#14308101)
Because every few months, something takes over web developement.
Re:Why is React is taking over front-end development? by pmarreck on Wednesday May 10, 2017 @09:50AM (#14308129)
See: why I went to the backend.

Things are more static, and more easily automated-testable.

Re:Why is React is taking over front-end development? by spmurrayzzz on Wednesday May 10, 2017 @10:22AM (#14308379)
I too spend 90% of my time on the backend (Node.js mostly). But when I do work on the front-end, I feel that I can get the same relative static comfort by using the most hardened API available to me: the DOM.

I get that its pretty verbose and historically has been far from perfect, particularly in the early-to-mid 2000s, but I really have trouble understanding this allergy new devs have to the native web platform. Its not that hard to be productive and you can do so without having a nightmarish preprocessing toolchain. And by bootstrapping yourself to these framework/library ecosystems, you usually don't get a sense of the problems they venture to solve. Everything becomes a magic black box.

As an aside: libraries have never seemed like the true pain point for new FE devs. My anecdotal observation is that the wheels fall of the wagon when it comes to application/API design.

The obvious corollary here of course is that you can easily build a very poorly designed React/Redux app. We're just trading one problem space for another, in my view.

Re:Why is React is taking over front-end development? by onion2k on Wednesday May 10, 2017 @10:05AM (#14308245)
One of the big advantages of React is that it's straightforward to unit test your components. Plus there's Jest, which makes a lot of the hard bits of testing much easier.

(I say this as a developer who mostly uses Angular and Vue rather than React. I wish I had the React toolchain in other frameworks.)

Re:Why is React is taking over front-end development? by pmarreck on Wednesday May 10, 2017 @11:01AM (#14308700)
How would I run a React unit test from the command line? Or would I have to run it in-browser? Any pointers would be welcome
Re:Why is React is taking over front-end development? by onion2k on Wednesday May 10, 2017 @11:53AM (#14309166)
Jest uses jsdom. You just need to add it to a project ("npm install --save-dev jest"), write a spec, and then run npm test (maybe update package.json to have 'jest' as the test command). It's really, really easy.

There's even a repl so you can try it in a browser first - https://facebook.github.io/jest/#use

Re:Why is React is taking over front-end development? by cholantesh on Wednesday May 10, 2017 @11:35AM (#14308956)
I prefer backend, too, but I found that I had to develop my frontend skills to remain employable. Definitely prefer working on the server side, though.
Re:Why is React is taking over front-end development? by awjr on Wednesday May 10, 2017 @09:32AM (#14307991)
I think the title is slightly wrong. "Why is React better than plain JavaScript DOM manipulation?" might be a better title.

I was hoping for a more indepth analysis of industry trends around different JS UI frameworks.

Re:Why is React is taking over front-end development? by crimsonalucard on Wednesday May 10, 2017 @10:29AM (#14308450)
There is rarely a logical reason for why something is taking over front-end development.

Take javascript for example. Let's face it... javascript is a shit language. Why did it take over front end web development? Because of Logic? No. Why did React take over front end web development? Because of Logic? Maybe.

The react + redux ecosystem has major issues that need to be addressed.

Problem #1: complex tool chain.

Problem #2: Forced OOP. Components need to be objects to use this.setState(). Why is this design necessary? See cycle.js.

Problem #3: redux... functional programming / immutable programming is not necessarily the best choice for a Model in any architecture that contains a model (MVC). Try building an app with a complex tree structure for the model then update a node in the middle of that tree and see what immutability does for you... Welcome to the world of Zippers and lenses..

In fact View components should be immutable and the model itself should be mutable... In react + redux it's the other way around!

We can do better. React + redux are not the holy grail.

Re:Why is React is taking over front-end development? by crimsonalucard on Wednesday May 10, 2017 @01:49PM (#14310083)
Just want to mention. Does it make sense for a model in the backend to be immutable? Imagine that... Immuteable mysql... Why does this make sense on the front end? Why? Why? Why?
Re:Why is React is taking over front-end development? by iLemming on Thursday May 11, 2017 @12:26PM (#14317275)
You ever heard about Datomic?
Re:Why is React is taking over front-end development? by crimsonalucard on Thursday May 11, 2017 @06:54PM (#14320196)
Nope. What about it?
Re:Why is React is taking over front-end development? by sebringj on Wednesday May 10, 2017 @09:59AM (#14308211)
My perspective is React was always very simple and I use React Native and React so it is easy to transition between them. My focus then becomes on getting actual things done.
Re:Why is React is taking over front-end development? by acdha on Wednesday May 10, 2017 @09:40AM (#14308056)
“React is just JavaScript”

That's like saying Windows is just C/C# – it's technically somewhat true but over-simplified to the point of being useless.

Re:Why is React is taking over front-end development? by dowrow on Wednesday May 10, 2017 @10:14AM (#14308309)
Vue < React < Angular Hacky micro-frameworks are not the way to go for big, serious, retro-compatible apps developed by big distributed teams.
Re:Why is React is taking over front-end development? by tchaffee on Wednesday May 10, 2017 @10:19AM (#14308348)
Does Vue allow you to use only javascript like React does? After getting over my initial resistance of using javascript as my "templating language" I am kind of done with frameworks that try to make HTML into a programmable language.
Re:Why is React is taking over front-end development? by Kiro on Wednesday May 10, 2017 @10:21AM (#14308373)
Same and I'm using Vue in production where the template has become a complete mess very similar to what happens in Angular 1 applications.