Performance: Standalone component declaration
MEDIUM IMPACT
This affects the initial page load speed and bundle size by reducing module overhead and simplifying dependency resolution.
import { Component } from '@angular/core'; @Component({ selector: 'app-example', standalone: true, template: `<p>Hello World</p>` }) export class ExampleComponent {}
import { Component, NgModule } from '@angular/core'; @Component({ selector: 'app-example', template: `<p>Hello World</p>` }) export class ExampleComponent {} @NgModule({ declarations: [ExampleComponent], imports: [], bootstrap: [ExampleComponent] }) export class AppModule {}
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| NgModule-based component | Standard DOM nodes | 1 reflow per component bootstrap | Normal paint cost | [X] Bad |
| Standalone component | Standard DOM nodes | 1 reflow per component bootstrap | Normal paint cost | [✓] Good |