Live data from Hacker News

Angular 2 versus React

medium.com

151–160 of 249 posts

Re: Angular 2 versus React

#151

React's learning curve is tiny compared to Angular. With React, you need to understand the component API, which consists of about 5 methods that one uses regularly, and the top level API, which consists of 2 (or just 1 if you use ES6 class syntax to create components). And as the article points out, it's just JavaScript.

I had the complete opposite reaction. I learned a bit of React through a rails + react tutorial and I was lost pretty much the entire time. Having to write HTML using either JSX or the ReactDOM syntax was a complete nightmare. Granted the testing options of both beat out angular, but even at a surface level React just wasn't appealing.

> Having to write HTML using either JSX or the ReactDOM syntax was a complete nightmare.

Can you expand on this? I find writing JSX to be a breeze. JSX is basically HTML with a few small tweaks (e.g., for => htmlFor, class => className). If you use a linter, it will catch those mistakes for you while you're learning.

Re: Angular 2 versus React

#152
post #98

Earlier quoted context omitted.

But do you want web designers to mess with your markup? Many of the projects I work on still involve the 'old-fashioned' server-side rendering approach with bits of jQuery for interactive elements. If a non-coder webdesigner were to mess with my markup, everything would break anyways. I guess what I'm saying is that I've worked on many types of projects in many kinds of environments, and whenever a front-end framewor…

I don't have a horse in this race, but do you think that learning JSX is going to be any easier for non-coders?

Honestly I wouldn't hire a web designer that can't code a little Javascript. It's been a while since knowing only HTML as a web designer has been acceptable.

To answer your question though: they're probably about the same level of difficulty, and I don't think it's a great argument for vanilla/React/Angular because a person who doesn't understand code trying to modify stuff that is controlled by code is going to break something regardless of what JS framework you're using.

I prefer JSX because it's not pulling wool over your eyes - you're building a JS app, not an HTML app - so let's stop pretending. The ESX syntax is just a nice way of forming a hierarchy of class instances. The beauty of React is that you could come up with your own syntax for doing that and use it just the same, because React is just Javascript.

Re: Angular 2 versus React

#153

Earlier quoted context omitted.

I'm building an app with Ember, and I like how it abstracts away the more tedious aspects of web development without preventing me from moving to a lower level of abstraction when I need to. I've built a small app in vanilla JS, so I know what the alternative to using a framework is like. Doing XHR by hand is not easier than using Ember-Data. Writing custom JS components is not easier than extending Ember's Component…

What do you think about Ember's mobile performance problems?

Have you seen this? https://meta.discourse.org/t/the-state-of-javascript-on-andr...

This problem is not Ember but JavaScript in general.

Re: Angular 2 versus React

#155

Earlier quoted context omitted.

> This is the year of framework fatigue. This is the year of the framework fatigue meme. Next year is the year everyone realises why we had frameworks and tries to salvage the mess they made last year, when they wrote an app 'without a framework' and ended up with an under-specified, incomplete, undocumented, informal framework.

Nah, that's a few years in the future. Typically it takes about 5-10 years for programming trends to reverse themselves.

Yes this may have been true a few years ago but no longer...we are in the of age of programming-trend warp drive where they may reverse every 6 months or less.

Re: Angular 2 versus React

#156
post #9

To me it really feels like Polymer is taking all of the pros from both of these "libraries" or "frameworks" or whatever you want to call it and none of the cons. Why aren't we talking more about that? Polymer is a fraction of the size. It's one of several ways right now to write custom components. React and Angular2 do the same thing yet they are both bloated and force tons of tools and tech down your throat. For wha…

FWIW, part of the reason for Angular2's 'cringe-inducing template syntax' is so that it'll play nice with Web Components / Polymer.

Re: Angular 2 versus React

#157
post #48

What's your take on vue.js?

I've used it for three projects so far, and I'm in love. The syntax is so clean, super easy to learn, and quick to get going. Bind to a parent element, add your data vars, methods, and add your data bindings. Done. It's certainly not as heavyweight as Angular, and that's a good thing. I played with the other big frameworks, and they were so complex for even the basics. I get 99.9% of the work done that I need to with it and should be at the top of these framework lists.

Re: Angular 2 versus React

#158

Earlier quoted context omitted.

To clarify, Polymer relies on web components polyfills. The polyfills are separate and usable by any other project. Also, components don't have to be stateful. An element can be viewed as a function invocation which accepts attributes, properties and children and returns DOM. An element which deterministically renders some DOM based only on those inputs is very much like a pure function.

But still creating domnodes on each invocation. React is shielding the dom

React still eventually creates DOM nodes eventually, so I'm not sure what you mean.

How a custom element produces its DOM nodes are entirely up to it, and several approaches fit with a pure functional view of elements: 1) re-render and replace the entire component DOM, 2) Use a VDOM to patch the component DOM, 3) Use incremental-dom to update the component DOM, and yes 4) template systems like Polymer's can be easily used in a pure functional approach.

The key to being "stateless" isn't in abstracting away the DOM, it's in only using the inputs (attributes, properties, and children) to determine the DOM structure, and only allowing the host of an element to modify inputs so that the element behaves more like a function.

It's similar to mutable object that never modifies its own state, only has public state, and whose methods are pure. Method behavior is fully determined by state that the owner controls.

Re: Angular 2 versus React

#159
As a new web developer, where do you draw the line between a web application rendered server side and a SPA? I'm trying to develop a web app for creating invoices for a niche market but in this case I don't see huge advantages for a SPA over rendering HTML server side, the added complexity of a SPA doesn't have that big of a reward, I still plan to separate the frontend and backend, for example, writing a HTTP API that outputs json and in another process(or server) consume the json and render HTML in the frontend server (and maybe add some JS to improve interactivity). But everything this days seems about creating SPAs for new apps and that's definitely the future it seems, I'm wrong following this route or is that I'm just consuming to much SPA hype?

Re: Angular 2 versus React

#160
post #9

To me it really feels like Polymer is taking all of the pros from both of these "libraries" or "frameworks" or whatever you want to call it and none of the cons. Why aren't we talking more about that? Polymer is a fraction of the size. It's one of several ways right now to write custom components. React and Angular2 do the same thing yet they are both bloated and force tons of tools and tech down your throat. For wha…

FWIW, part of the reason for Angular2's 'cringe-inducing template syntax' is so that it'll play nice with Web Components / Polymer.

Hey Rob- that was probably unfairly harsh of me. I have tried to like the syntax for the last year and I've had trouble.

Anyway, I know you are a big contributer, do you mind showing me the discussion where we determined '*ngFor=' and '[(two-way)]=' was implemented to play nicely with WC? I would be interested in reading. Thanks!

Post reply on HN