News for hackers. Stuff that matters.
Re:Angular 9.0 by tannhaeuser on Friday February 07, 2020 @02:16AM (#22263870)
I'm not a React hater (in fact, I like it a lot when it fits) but I think when people criticize React, they're actually after the one-size-fits-all attitude displayed in comments such as yours. No, React is clearly not "the only sane way of doing web development" considering the web hosts many types of markup applications, the most successful ones predating React by decades.
Re:Angular 9.0 by DonHopkins on Friday February 07, 2020 @03:58AM (#22264274)
Off topic: I've always meant to ask you: Is your name a Blade Runner reference, or are you a user something called "Tannhae"? ;)

https://en.wikipedia.org/wiki/Tears_in_rain_monologue#Tannh%...

https://en.wiktionary.org/wiki/%E6%8E%A2%E6%B5%B7

Re:Angular 9.0 by tannhaeuser on Friday February 07, 2020 @04:32AM (#22264437)
Don't interpret too much into it :) When I signed up to HN and had to choose a nick, I sat in my living room looking at a Tanne (a fir in German) outside, and chose Tannhäuser (literally, a man who lives in the woods) in a hurry. If anything, it's a (quite arrogant towards the HN crowd) reference to Richard Wagner's opera/character rather than Blade Runner.

Hopefully you're not disappointed :)

Re:Angular 9.0 by DonHopkins on Friday February 07, 2020 @06:09AM (#22264903)
Tannhäuser Gate is only the most enigmatic reference of the best scene of the best movie in the universe, and I never heard of any mind altering substance called Tannhae that you were admitting to use (are you a Can-D user or a Chew-Z user? [1]), so I assumed it must be a Blade Runner reference! But now I understand it's a direct reference to what Roy Batty may have been indirectly and allegorically referencing, which is quite un-disappointing. ;)

[1] https://en.wikipedia.org/wiki/The_Three_Stigmata_of_Palmer_E...

Re:Angular 9.0 by ofrzeta on Friday February 07, 2020 @01:15PM (#22268930)
Tannhäuser is also a opera by Richard Wagner (which refers to some older folk tale): This is probably what Philip K. Dick inspired to use that name.
Re:Angular 9.0 by jbergens on Friday February 07, 2020 @07:26AM (#22265314)
I personally think React scales well both up and down but you can avoid Redux for small things. Use Mobx or some easier state management lib and you are all set.
Re:Angular 9.0 by Cthulhu_ on Friday February 07, 2020 @07:39AM (#22265391)
Better yet, avoid it entirely and stick to using React's Context (https://reactjs.org/docs/context.html) or if you have to, useReducer() (https://reactjs.org/docs/hooks-reference.html#usereducer).

Of course, those are lightweight / 'native' (to react) alternatives to redux / state management; last time I used it there were some really neat (theoretical) advantages, such as a browser addon where you could do time traveling debugging (replay individual events) or push the state and all state changes into a support ticket for reproducibility. Purely theoretical though, and at the time using Redux added a lot of mental and labor overhead, especially when using it to manage forms. (personally, I think form data should never be part of a global state; it should be limited to a component that manages the data itself and does not leak it elsewhere. But, it depends on the situation, as always)

Re:Angular 9.0 by lukevp on Friday February 07, 2020 @08:30AM (#22265734)
I think a blend of both is the best approach for most apps. Redux for global state, api interactions, etc. so that you get the power of middleware like thunk and saga and get great debugging support for overall app state, then anything local to a page or component (like you said, for form data) you use a react context and useContext it in child components to hook up events and manage page level state using useReducer or useState within your page component. This model has been very successful for us and helps partition state in an easy to understand way.
Re:Angular 9.0 by crubier on Friday February 07, 2020 @02:53AM (#22264001)
Only sane way, you missed a word. Of course there are other ways, but they clearly flawed in my opinion. I used to hate web development before 2014 and now I love it. Php is an awful language, jquery was a nightmare. Angular makes no sense hence why it keeps reinventing itself, Vue forces you to have some logic expressed using an ad hoc language in templates like it’s 2010 instead of just using JS constructs etc...

I stand by my point, I am yet to find a use case where some form of react is not the best solution. Whether it is server side rendered, a single page app, or statically rendered.

The only criticism I hear about react boil down to people complaining about bad practices that are not linked to react, but merely conflated with it, like not caring about bundle size, messing architecture or other aspects that are orthogonal.

Re:Angular 9.0 by goatlover on Friday February 07, 2020 @02:02PM (#22269472)
> Whether it is server side rendered, a single page app, or statically rendered.

Nail meet hammer. Seriously though, what why you need a JS framework for static pages? What if your backend is in Go? What if you're doing heavy duty numerical analysis? What if your users want a Wordpress-like site? What if your team uses Rails or Drupal to quickly build sites?

You're saying React is better at everything?

Re:Angular 9.0 by izietto on Friday February 07, 2020 @03:12AM (#22264077)
> Vue forces you to have some logic expressed using an ad hoc language in templates

That's not true, you can use JSX with Vue, we do use that for one of our clients and it hasn't raised issues whatsoever

Re:Angular 9.0 by crubier on Friday February 07, 2020 @03:38AM (#22264193)
You are right indeed, but from a developer point of view at that point you could be using a react based framework and your experience would be the similar to vue with JSX.

Render functions returning JSX is the key brilliant idea invented by react and the fact that vue adopted it just proves the point even more:

React or the ideas at the core of react are not the mistake of the last decade but the blessing of the last decade for web development (and more).

Re:Angular 9.0 by izietto on Friday February 07, 2020 @03:50AM (#22264243)
> from a developer point of view at that point you could be using a react based framework and your experience would be the similar to vue with JSX

It will not, because Vue has a better integration with the data source (Vuex) and a better integration with the routing (Vue Router)

I mean, I agree that React is an awesome framework implemented upon great design ideas (pure functions and plain JS templates), but it has its shortcomings, that frankly make me still prefer Vue to React (mainly Redux and the router)

Re:Angular 9.0 by crubier on Friday February 07, 2020 @03:56AM (#22264269)
For routing react-router is just perfect. And for data source/state management there is plenty of choice, I use Apollo for global state/data source and useState for small state full interactions, I can’t see how it could get simpler.

But whatever floats you boat really, the point is that the nice part of vue are inspired by react anyway. I wish the two community merged, to be honest, I see no point in dividing for such small differences.

Re:Angular 9.0 by spaceribs on Friday February 07, 2020 @06:35AM (#22265033)
> But whatever floats you boat really

You specifically argued against that, your arguments seem to be highly religious in nature.

I don't know how many years you've worked in the industry but if you think React will be the dominant way of building apps for the next ten years, I have some Adobe Flash developers who I'm sure would like to say a few words.

Re:Angular 9.0 by orange8 on Friday February 07, 2020 @07:19AM (#22265269)
haha! Former hotshot Flash ActionScript 3 Ninja Developer reporting for duty as requested.

Seriously though, JSX and TypeScript are nothing new. Both were part of ActionScript 3, a big language backed by a powerful company (Adobe). 15 years later, nobody even remembers it existed. How am I still making a comfortable living coding today? By not getting too attached to any language or framework... they are all just tools in the end.

So let the young ones be, time will eventually teach them those lessons, sooner than they think.

Re:Angular 9.0 by pier25 on Friday February 07, 2020 @11:07AM (#22267313)
Huh? AS3 had XML integrated into it?

I remember E4X and Flex but not a JSX like syntax.

Re:Angular 9.0 by orange8 on Saturday February 08, 2020 @02:41AM (#22274553)
It wasn't exactly like JSX, more powerful as the XML was just another program data type to work with like strings and arrays.
Re:Angular 9.0 by crubier on Friday February 07, 2020 @02:57PM (#22270185)
The ideas behind react will still be big in ten years yes.

My arguments are not religious but based on facts, I can share my PhD thesis from 2016 about user interface specification languages, that includes a comparison of more than 20 different approaches including react.

Flash was always a proprietary platform and only fools would have bet their whole career on it back then. The situation of the ideas behind react, and browsers as a platform are very different.

I’m not betting my career on it though (I’m a CTO in a company which Is not centered around web stuff) but I do believe that these ideas will leave an impact in the industry, and this belief is backed by specifically studying this topic for 4years, plus my 15years in the industry.

Re:Angular 9.0 by spaceribs on Friday February 07, 2020 @05:07PM (#22271565)
I'm a UI architect of a major SaaS company who maintains our 4-5 products between 8-10 feature teams. I've worked in the web industry for 11 years.

My job is to enforce some semblance of sanity between very smart and clever engineers without heavily impacting their ability to deliver. My job entails much cat-herding, setting norms, and maintaining expectations.

Every day I thank the gods we went with Angular. It has saved us countless times, every refactor is a joy, every upgrade is painless, every component is easily shared.

I don't have to constantly worry about XSS, I don't have to explain how I want things structured (because the build fails if they don't structure it right), and I don't have to worry that if someone leaves, no one will know how to pick up and modify their project.

Do developers hate it? Absolutely! They want to get work done fast and pump out cool, clever, smart work! They see Angular as a hinderance to the objective of "doing" because now they need to know about all these damn opinions that aren't their own. Angular isn't for them, it's for everyone else.

By contrast, React enables selfish coding, which while totally okay when you have a few people and clear lines of ownership, does not scale well without strictly defined responsibilities and amazing cultural levels of synchronous decision-making.

Re:Angular 9.0 by rawoke083600 on Friday February 07, 2020 @08:15AM (#22265624)
I don't want a "you could..." in my framework... I want a "this is the way" in my framework. Thus me the dev before me... the dev after me can get on with things. It will not be the perfect solution but it will be a consistent solution... This is of course true for any framework.