Db2Code–part 7 – Angular vs React

Once you have the REACT implementation, you will think that Angular implementation will be a breeze. Not . Some pain points and differences :

1.  Angular have the power of separating components into html code and JS/TS code. While this is a feature for the developer, it becomes hard for code generators  to generate 2 different files .So it will be one file and the component will have template instead of templateURL  React, instead , is just one file/function to generate .

2.  REACT can load dynamic function with just import  the js/ts file- since all HTML in JS/TS is basically JS . To  import dynamic in Angular is a hard  – read https://angular.io/guide/dynamic-component-loader 

3. In the same idea , the Angular components must be registered into an NgModule – or make them standalone :https://angular.io/guide/standalone-components . Anyway, this affects the DI – a hard thing to do . In REACT, just import them ( and yes, framework vs library – but I wish in Angular to be easier )

4. In REACT we have the useState – in Angular there will be Signals.  I wait – the code will be prettier .

5. REACT is more ugly – with all callbacks and memos. Angular seems prettier.

6. The DI in Angular is awesome . Just decorate what you need with @Injectable

The final result is at https://marketplace.visualstudio.com/items?itemName=ignatandrei.databasetocode