Du kannst nicht mehr als 25 Themen auswählen
Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
Skill 13 - Blazor Components
Core Concepts
- Blazor apps are built from components.
- Components combine markup, C# code, parameters, events, lifecycle methods, and rendering behavior.
- Rendering can happen server-side, client-side, or with static server-side rendering depending on hosting model.
Component Rules
- Keep components small and focused.
- Use parameters for input and event callbacks for output.
- Avoid putting complex business logic directly in components.
- Extract reusable UI into child components.
- Use services for data access and state that crosses components.
- Be explicit about render modes and interactivity.
Lifecycle Rules
- Use initialization lifecycle methods for loading setup data.
- Use parameter-set lifecycle methods when behavior depends on changing parameters.
- Avoid unnecessary calls to
StateHasChanged.
- Dispose subscriptions and unmanaged resources.
Forms
- Use
EditForm for model binding and validation.
- Use validation attributes or custom validators for input rules.
- Keep validation rules shared with the domain when practical.
- Do not trust client-side validation alone.
Performance
- Avoid excessive component re-rendering.
- Use
@key when rendering lists whose identity matters.
- Keep large data operations out of the render path.