Live data from Hacker News

Angular v8.0

github.com

201–210 of 210 posts

Re: Angular v8.0

#201
post #70

Earlier quoted context omitted.

Since JS is the only thing you can actually use[1] in a browser you can argue that anything that runs in the browser is syntactic sugar (and in fact, Typescript is syntactic sugar). A less flippant analogy might be macro support in Rust. It's clearly part of Rust, but the syntax is completely different and it requires IDEs to have completely separate processing just to handle it. I wouldn't consider that to be mere s…

JS and JSX are isomorphic (in the mathematical sense) hence why JSX is considered just syntactic sugar. JS and TS aren't isomorphic (there's no inverse morphism once you go TS->JS that can bring the resulting JS back to the original TS) hence why TS is a different language (even if a superset of and compiled to JS).

> JS and JSX are isomorphic

They are not

Or, if they are, they are in the same way of a custom XML templating language that can be translated to a specific javascript library implementation and then back to XML

In the same way, is Mustache isomorphic?

    "{{title}} spends {{calc}}"
can be translated to

    `${title} spends ${calc}`
and back to

    "{{title}} spends {{calc}}"

Re: Angular v8.0

#202
post #70

Earlier quoted context omitted.

JS and JSX are isomorphic (in the mathematical sense) hence why JSX is considered just syntactic sugar. JS and TS aren't isomorphic (there's no inverse morphism once you go TS->JS that can bring the resulting JS back to the original TS) hence why TS is a different language (even if a superset of and compiled to JS).

> JS and JSX are isomorphic They are not Or, if they are, they are in the same way of a custom XML templating language that can be translated to a specific javascript library implementation and then back to XML In the same way, is Mustache isomorphic? "{{title}} spends {{calc}}" can be translated to `${title} spends ${calc}` and back to "{{title}} spends {{calc}}"

[deleted]

Re: Angular v8.0

#203

Earlier quoted context omitted.

I disagree. If you use create-react-app you get best practices out of the box. React is also much less abstraction away from vanilla JS. Learning Angular is learning a new language with a whole bunch of restrictions. Learning React is like learning JS++. (This is my personal experience based on three Angular projects and ten+ React projects.)

Yea? What about routing, forms, state, styles encapsulation, code separation to modules, http clients, etc. A lot of choices for new React project, zero choices for Angular === faster startup.

Forms: use HTML5 and expand on that. State: quick read, I'd say use context, hooks and effects if you're new. Styles: I despise style in JS, so I go with SCSS or CSS. The encapsulation problem is made up in 90% of all apps. Http: just use fetch. If you'd like, you can write a vanilla wrapper around it. Code separation to modules - don't get what you're going at really. Build functional components. Keep shared logic in services, a POJO wrapping functions and exporting it all.

Re: Angular v8.0

#204

Earlier quoted context omitted.

If you were new to React or Angular, but needing to choose one for a single developer project, which would it be now in 2019?

Angular is easier to get up and running. Then you also have a very solid foundation that can be picked up easily by new devs starting on the project. Whereas, React seems to work only for more experienced front-end developers since you have to make more choices. If someone is just starting out it can turn into a mess pretty quick.

Comparing Angular to React is comparing apples to oranges. It would make more sense to compare Angular to React based frameworks such as NextJS [0]. Those are "easy to get up and running" and offer "a very solid foundation that can be picked up easily by new devs starting on the project", as well.

[0]: https://github.com/zeit/next.js/

Re: Angular v8.0

#205
post #89

Earlier quoted context omitted.

> and I still have no idea how I only do stuff on the client in a SSR environment (stuff that i did in componentDidMount) The 'useEffect' hook - it won't be executed if you use e.g. ReactDOMServer.renderToString() for SSR useEffect(() => { console.log('Client side only'); }, []); Codesandbox: https://codesandbox.io/s/peaceful-dew-nvw83

While you wouldn't want to leave "console.log" in your code in production, you can use them in function components just like a classes' render methods. A better example (from the video "React Today and Tomorrow and 90% Cleaner React With Hooks" from October[1]) is something along the lines of updating document.title = `${some} Page` or possibly calling an API. [1]: https://www.youtube.com/watch?v=dpw9EHDh2bM

The console.log was only there to illustrate that the code in useEffect's callback is only being run on the client-side (see the codesandbox I linked to).

I think it's clear from the parent I was responding to that they have better use-cases in mind :)

Re: Angular v8.0

#206

In my opinion Angular's story is a story of how people invent problems and then valiantly tackle them. - We want to re-write the whole thing from scratch. In TypeScript. - And let's use Google's Closure Compiler for JavaScript. Even though it doesn't support TypeScript, modules, or anything, really from non-Google Javascript world (at the time) - Oh. Then... Let's create a TypeScript to Closure Translator even though…

What's the point you are trying to achieve with that negativity? Writing non existing tooling around some tools is almost positive as they can pave the journey to other and better tooling. Also, I doubt you are paying a cent to those developers to justify your complaints about it.

> What's the point you are trying to achieve with that negativity?

Not trying to achieve anything. It’s my own personal opinion on how I view Angular’s development. The devs dig deeper and deeper holes to bravely climb out of them.

> Writing non existing tooling around some tools is almost positive

Since there’s no cost-benefit analysis, “almost positive” is entirely speculation.

> I doubt you are paying a cent to those developers to justify your complaints about it.

“Only paying customers are allowed to voice criticism. Please purchase a criticism package or a yearly subscription today. Volume discounts are available, contact your nearest sales representative”

Re: Angular v8.0

#207

Earlier quoted context omitted.

This is precisely what I don't like about Angular. That there is all this stuff . And I have to care about what it is doing under the hood (and this is complicated and not especially well documented). In React if I have performance issues, then it's pretty easy to work out what's causing them.

You can largely ignore what Angular is doing under the hood, tbh. If you're having performance issues, the answer is often related to change detection (aka, Zone.js).

> If you're having performance issues, the answer is often related to change detection (aka, Zone.js).

This is part of Angular really. At least it's not optional to use it. Change detection issues are not fun to debug!

Re: Angular v8.0

#208

Earlier quoted context omitted.

You can largely ignore what Angular is doing under the hood, tbh. If you're having performance issues, the answer is often related to change detection (aka, Zone.js).

> If you're having performance issues, the answer is often related to change detection (aka, Zone.js). This is part of Angular really. At least it's not optional to use it. Change detection issues are not fun to debug!

> At least it's not optional to use it.

Zone.js is optional, although it is on by default. It's considered best practice to remove it when building standalone components with Angular Elements.

Re: Angular v8.0

#209
post #78

Earlier quoted context omitted.

As a long time React developer, I second this. Especially this part: > There's no need to evaluate different routers, form libraries These two things have been the bane of my React development experience ever since the days of "flux". Every new React project I start I end up using a different set of libraries, and it's not just me either -- a very experienced React dev I work with just switched our React e-commerce S…

If you were new to React or Angular, but needing to choose one for a single developer project, which would it be now in 2019?

Angular. Getting up and running is much simpler.

Re: Angular v8.0

#210
post #106

Earlier quoted context omitted.

I've been using Angular for a few months now and it's mostly been a good experience. We've been using Angular 7. My biggest gripe, and this might just be my inexperience, is fighting the change detector to try and ensure reasonable performance when displaying a large number of elements. There are certainly mechanisms to do this but it does seem to take some work.

what's your use case to display a large number of elements in the same page? Curious.

like lists with thousands of elements? OnPush change detection and virtual scrolling - https://material.angular.io/cdk/scrolling/overview
Post reply on HN