Live data from Hacker News

Opinionated Comparison of React, Angular2, and Aurelia

github.com

131–140 of 169 posts

Re: Opinionated Comparison of React, Angular2, and Aurelia

#131
post #19

> Save the global components off as global variables and just use them ... When my ActivityIndicator component mounts, it saves itself off to a global. Any code can import busy and run busy.start() and busy.stop(). What is the story that FP folks need to tell here, so that people don't do things like this?

Nothing. We know it's messy, but React doesn't really provide a better way of doing this. Context is barely mentioned in the docs, "not recommended" by the devs. Redux is incredibly verbose and overcomplicated. Passing "global" things down in props is just madness (if everything needs it). Personally I use context, or a singleton (which is just a hidden global really). It's naughty, but usually required for one or tw…

React doesn't, but JS perhaps does.

A lot of my code has to be mounted in separate root components and it's not allowed to be a SPA.

In this instance, it was convenient to use event listeners, though it's very similar to calling a global.

Re: Opinionated Comparison of React, Angular2, and Aurelia

#132

> There are a few more frameworks I would have loved to try, including Polymer and Vue.js. There just wasn't enough time to do a deep dive with all of them. I hope he gives Vuejs a try. As a javascript beginner, who tried Angular, Angular2, A bit of React and VueJS, I just loved the flexibility and approach of VueJS. I was instantly productive thanks to the amazing documentation and vue-cli that just worked out of th…

I wish the author had tried Polymer because it's the most underrated one. I just love the way Polymer components declare/consume dependencies (as tags in the component file) and connect all sub-components in the template markup via attributes - It makes data binding relationships between components and their children very clear. Polymer is basically an inverted version of React (and it achieves a similar outcome). In…

I've used both Polymer and Vue for a few projects, and Vue's single file component method, coupled with WebPack, is almost identical to writing an app with Polymer.

Except that Vue doesn't ship with all the Polyfill baggage that Polymer does. Polymer has came a long way, but it still feels slow on anything but Chrome.

Once the Web Component spec is finalized, and built into browsers, I think Polymer will be a great choice. Today though, I gotta give the nod to Vue.

Re: Opinionated Comparison of React, Angular2, and Aurelia

#133
post #87
post #53

Earlier quoted context omitted.

Isnt Redux about using components to dispatch actions, and all the logic happens in the reducers for the store? So, the Model part is not inside the react view components which are just used for display. If you have uncontrolled components(React terminology for forms with extra data not handled by props), then form validation might require some processing in the components.

Partially, you're right. Some logic happen in reducers, but not all, because they must be pure. For example, you can't call new Date() in a reducer, because it's not pure. Imagine you have a TodoList with Items that have: a priority and a createdDate. TodoList is always sorted by 'priority, created DESC'. There's also an email service that gives you a high-level overview of the TodoList like so: High Prio (3 items) M…

It's 100% Redux ecosystem responsibility to perform the actions you want. I understand where you come from, as you perfectly described a procedure and it sounds natural to think that way. Redux and Event sourcing systems force you to decompose in 3 functions this procedure

- Action creator: the action creator newTodo() creates an action = {type: 'new', body = 'yo', date: new Date()}. This action creator can be colocated in the reducer file.

- Selectors: the summary is a denormalized view of the normalized state. Many would argue it is not a business logic but a display logic. Same for the sorting. A selector is a function that takes a part of the state as an input and return a new datastructure. Use reselect if you have perf concerns and want to persist it. It can be colocated code wise with the reducer file.

- Saga: for the side effects of sending an email, we use Redux Saga for ol' REST based endpoints. Those can be colocated code wise with the reducer file.

So yes you have 4 functions for your todo business logic: some action creators, some selectors, some sagas and the reducer. They can all be in the same file. It takes a bit of practice to figure out what is the right cut-off point. But all in all, interns and old farts like me all grasped it way more easily than Angular 1 scope concept for a more rewarding value.

Re: Opinionated Comparison of React, Angular2, and Aurelia

#134
post #73
post #31

Earlier quoted context omitted.

Author didn't compare "plain React". Author compared React with React Router (and possibly Redux/whatever for state). Did you only read the part about the documentation?

I doubt the author was using Redux if he was praising React and Typescript...

Why? I've used Redux and TypeScript together before. They make a really nice combination.

Re: Opinionated Comparison of React, Angular2, and Aurelia

#135

The ending is what makes this article: >Overall, I'm not 100% sure I made the right choice, but I only have to live with it for two years. People are great at short term thinking, and tend to be terrible at long term thinking. Just some anecdata: I had a look at some source code for a 10+ year old web app before JS libraries were popular. I could understand perfectly how a click on a link resulted in a URL hash chang…

Don't worry, the simpleness and adequateness of plain old JavaScript (+ maybe jquery) and basic web techniques is re-discovered like every 5 years. Right now, we're at the height of the React hype cycle which just means we're approaching its imminent downfall due to generational forces (though I still do like some aspects of React specifically). Sorry to sound defaitist, but like you say, the goal of React (and Angul…

A critical point about these types of frameworks it that their benefits wont necessarily outweigh the complexity they bring to every project, and specifically they are likely to be needlessly complex in smaller projects.

In larger or long-term projects though the ability to use formal conventions to break down an app into components that have solid documentation already written on how to do this or that in a way that will scale and extend is quite valuable.

Additionally being able to reach out to a large community of developers who use similar conventions and plugins is quite valuable for troubleshooting those 10%/90% problems or finding a drag-n-drop solution that's compatible with your stack.

Re: Opinionated Comparison of React, Angular2, and Aurelia

#136
> React-router has gone through a lot of version churn. I used the (at the time) still-in-beta v4 router. This is good because it's clearly a better solution than prior versions. It's bad because all the tutorials and most of the online documentation refer to the old versions. Also there were no typings for v4 (since fixed).

And to think people complain about GTK changing too frequently...

Re: Opinionated Comparison of React, Angular2, and Aurelia

#137
post #73
post #31

Earlier quoted context omitted.

Author didn't compare "plain React". Author compared React with React Router (and possibly Redux/whatever for state). Did you only read the part about the documentation?

I doubt the author was using Redux if he was praising React and Typescript...

Why is that? -- Redux, React and TypeScript is a wonderful combination.

Re: Opinionated Comparison of React, Angular2, and Aurelia

#138
post #19

> Save the global components off as global variables and just use them ... When my ActivityIndicator component mounts, it saves itself off to a global. Any code can import busy and run busy.start() and busy.stop(). What is the story that FP folks need to tell here, so that people don't do things like this?

Nothing. We know it's messy, but React doesn't really provide a better way of doing this. Context is barely mentioned in the docs, "not recommended" by the devs. Redux is incredibly verbose and overcomplicated. Passing "global" things down in props is just madness (if everything needs it). Personally I use context, or a singleton (which is just a hidden global really). It's naughty, but usually required for one or tw…

ok, well "Nothing" means folks go OP route, globals everywhere—if that's expected than I guess there's no problem. I did not think globals everywhere was what React expected users to implement.

Re: Opinionated Comparison of React, Angular2, and Aurelia

#139
post #56

> There are a few more frameworks I would have loved to try, including Polymer and Vue.js. There just wasn't enough time to do a deep dive with all of them. I hope he gives Vuejs a try. As a javascript beginner, who tried Angular, Angular2, A bit of React and VueJS, I just loved the flexibility and approach of VueJS. I was instantly productive thanks to the amazing documentation and vue-cli that just worked out of th…

Agreed. I've used Angular 2, React+Redux, and now Vuejs on different projects (and on personal projects, stuff like om, elm, etc). Vuejs feels like they cheated somehow. For people in Redux-land: they took the reactivity of MobX and gave it Redux' level of debuggability. One important way, I think, is that Vuex formalizes the 'actions-dispatching-actions' use case of Redux middlewares (which redux says 'is not a part…

I really like Vue as well. However, one big problem I found with it is that the community is tiny compared to React. Whereas with React people would respond to my questions on SO within minutes, with Vue it can take days, and that is if I get a response. I'd consider myself intermediate-level so I can usually work my way around whatever problem I'm having, but I would hesitate to recommend Vue to a beginner.

Re: Opinionated Comparison of React, Angular2, and Aurelia

#140

The ending is what makes this article: >Overall, I'm not 100% sure I made the right choice, but I only have to live with it for two years. People are great at short term thinking, and tend to be terrible at long term thinking. Just some anecdata: I had a look at some source code for a 10+ year old web app before JS libraries were popular. I could understand perfectly how a click on a link resulted in a URL hash chang…

Yes, you can understand a 10+ year old web app's JavaScript, but that's because there was very little JavaScript on it to begin with.

I used to write a lot of jQuery, and in my experience once the code on a page became longer than ~500 lines, it became significantly more difficult to wrap one's head around.

With the new tools the baseline for understanding the code is higher, but if you meet that baseline then you can grok code that is much more complex.

Post reply on HN