blazor

Blazor

Specific best practices and architectural patterns when working with Blazor.

Details

Language / Topic
csharpC#
Category
framework

Rules

balanced

Blazor

- Use `@bind` for two-way data binding with form inputs. Use `[Parameter]` for component properties passed from parent. Choose Blazor Server for internal apps (real-time, thin client) or Blazor WebAssembly for public apps (offline, CDN).

Blazor

- Use `@bind` for two-way data binding with form inputs. Use `[Parameter]` for component properties passed from parent. Choose Blazor Server for internal apps (real-time, thin client) or Blazor WebAssembly for public apps (offline, CDN).
- Use `EventCallback<T>` for child-to-parent communication. Use `CascadingValue`/`CascadingParameter` for deeply nested data (auth, theme). Use `EditForm` with `DataAnnotationsValidator` for form validation. Implement `IDisposable` on components that subscribe to events. Use `@inject` for dependency injection in components.