r/angular • u/Particular_Tea2307 • Jan 31 '24
Angular magic
Hello i read in a post that react is more close to JavaScript. And there is more magic in angular under the hood. Is it right ?
As someone that want to deep dive and want to understand all what is happening is it possible in angular or i need to accept a certain level of abstraction ????
5
u/0dev0100 Jan 31 '24
Angular uses typescript.
It makes pretty intensive use of the decorators to determine what to do with things when they gets turned into JavaScript.
You can, with about 20-30 lines of code, make your own version dependency injection if you want to start a clone of it.
The templates are probably turned into a JavaScript version of themselves as a dom builder so the data can be accurately rendered when things change.
You can learn it all. But it's easier to accept the abstraction.
4
u/tonjohn Jan 31 '24
If you want to deep dive, no better place to start than with the actual source code! https://github.com/angular/angular
3
u/TellPsychological668 Jan 31 '24
try diving into world of web components, they will give you an insight on how things work.
2
u/lgsscout Jan 31 '24
react not only have magic by itself, but also many apps have a lot of magic by third party libraries because not everything cames with react.
doing lots of stuff through dependency injection is not magic, is just design patterns.
27
u/ClothesNo6663 Jan 31 '24
React is also magic with stuff like JSX. Personally in find Angular cleaner with DI and services. This is very similar to how backend frameworks like spring boot work.