To me, Angular is what HTML and the DOM would look like if they had been designed from the beginning for application development:
- Custom elements backed by controller classes. - Data-binding and event-binding syntax baked into HTML - Component style encapsulation, on by default.
React seems far more like a project created by people who dislike front-end development: As I recall the genesis of the project was to replace traditional DOM mutation with a more PHP-esque approach of updating state and re-rendering everything, just as you would do on the back-end.
I used to love angular, then I got a job which was a “| async” dumpster fire and spent a year watching a team of smart c# developers wallow in a mire of disaster so bad it became a two week regression to change a text field on a form. So full of amazing functional statement no one, even the original authors, could touch it without breaking something in the process.
so.
Your milage may vary. I no longer particularly like angular, personally, because I find it a chore to herd inexperienced FactoryInjectorConstructorFactoryPattern angular developers into not screwing things up.
...but talented team can do well with it too, and I’ve seen people screw up react projects too.
It really is more about good practice and experience than framework, your personal preference is probably, like mine, basically irrelevant.
Decorators aren't inheritable or composable. Because templates are strings, you need the hacky DI and superfluous module system to avoid tag name clashes.
As for React, it is nothing like PHP. JSX is a macro for function calls that return objects; as such they are first-class data structures with all of the benefits you would expect. Yes, it is just a view layer and you need to bring more stuff in if you have a big project planned.
If angular floats your boat that's great. The last time I used it was in a team of mostly C#, Java and Python enthusiasts. Once they figured out what was es2015, what was typescript, and what was Angual, the dev experience was generally reviled. (especially once they saw some react code). I generally don't say that I won't work with a technology, but after a year with it (and having years for AngularJS/1.x, React, Ember, Vue and Backbone under my toolbelt) I am content with saying that Angular sits with Backbone at the bottom of the pile of what I would choose to use again.
This is a really poor characterization. I started using React because I love front-end and it was exactly what I wanted front-end development to be. It solved every one of the pain-points I was experiencing with a jQuery/Backbone/Handlebars stack.
It feels like the people who meme about EnterpriseFactoryFactory at times just haven't hit the right use case for it.
Being familiar to a large base of existing developers is a huge feature.
My main gripe with Angular (vs. React) has been the lack of first class support for patterns (higher order components) that have been a boon for React. It does look like Angular will have more 1st class support with Ivy[1], however, higher order components are so simple with React (and even better with TS/React).
[1]: https://blog.nrwl.io/metaprogramming-higher-order-components...
I do not think that react classes will go away anytime soon. you can't represent state without them.
edit: Lol apparently two React devs ears were burning at the same time.
also btw: https://reactjs.org/docs/hooks-faq.html#do-i-need-to-rewrite...
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-nvw83A 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.
I think it's clear from the parent I was responding to that they have better use-cases in mind :)
And this
> (although the trend is to move away from them for performance and simplicity reasons)
Make me very frustrated because things like react became very popular for their simplicity. I read the reasoning the react team gave for hooks and I am not sure it justifies having such vastly different way of building components.
Then "C++ with inline assembler" is also a single language? What about English with quotes in Japanese?
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 syntactic sugar either.
[1] Yes, yes, wasm
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).
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}}"Personally I’ve found debugging and dealing with anything non-standard in React to quickly turn into a huge mess (but given all the praise heaped on it by other developers I know, I’m willing to concede that I might be doing it wrong).
You may argue that JSX is a single language, but that is irrelevant since you still need to understand HTML and CSS.
https://github.com/sveltejs/realworld/blob/master/src/routes...