Building reusable Blazor component libraries in .NET 10 Creating reusable component libraries remains one of the best ways to scale Blazor development. .NET 10 brings several improvements that make component libraries cleaner and more powerful. Create a Razor Class Library dotnet new razorclasslib -n MyComponents -o MyComponents Simple reusable component @* MyButton.razor *@ <button class="btn @CssClass" @onclick="OnClick"> @ChildContent </button> @code { [Parameter] public string CssClass { get; set; } = "btn-primary"; [Parameter] public RenderFragment? ChildContent { get; set; } [Parameter] public EventCallback OnClick { get; set; } } .NET 10 improvements useful for component libraries 1. PersistentState attribute You can now declaratively persist component state: [PersistentState] public string? SelectedValue { get; set; } 2. Better static asset handling Static files (including CSS isolation) get automatic fingerprinting and compression when served from a Razor Class Library. 3. Improved JavaScript isolation JavaScript modules from component libraries remain isolated and are easier to consume. 4. Validation improvements DataAnnotations validation now handles nested types more reliably — useful if your components expose complex models. Best practices - Keep components focused - Use [Parameter] + EventCallback - Prefer CSS isolation (.razor.css) - Document public parameters clearly - Consider the [PersistentState] attribute when your components hold state across prerendering Do you maintain your own Blazor component library, or do you mostly use third-party ones? #dotnet #Blazor #dotnet10 #ASPNETCore #ComponentLibrary #ReusableComponents
Открыть в Telegram
ASP.NET Core
Подписчики11 127
Просмотров на пост, 7 дн.766−38% к пред. 7 дн.
ERR6,88 %за 7 дней
Средние просмотры поста по дням
По дню публикации
Показать таблицей
| Дата | Просмотров на пост |
|---|---|
| 6 нояб. 2026 г. | 1 710 |
| 9 нояб. 2026 г. | 1 615 |
| 10 нояб. 2026 г. | 1 590 |
| 11 нояб. 2026 г. | 1 420 |
| 12 нояб. 2026 г. | 1 350 |
| 13 нояб. 2026 г. | 1 395 |
| 14 нояб. 2026 г. | 1 400 |
| 16 нояб. 2026 г. | 1 260 |
| 17 нояб. 2026 г. | 1 290 |
| 18 нояб. 2026 г. | 1 230 |
| 19 нояб. 2026 г. | 1 310 |
| 20 нояб. 2026 г. | 1 300 |
| 23 нояб. 2026 г. | 1 050 |
| 24 нояб. 2026 г. | 925 |
| 25 нояб. 2026 г. | 788 |
| 26 нояб. 2026 г. | 743 |
| 27 нояб. 2026 г. | 607 |
Самые просматриваемые за месяц
- Просмотры1,71 тыс.Пересылки—Реакции10Комментарии—
- Просмотры1,67 тыс.Пересылки—Реакции6Комментарии—
- Просмотры1,59 тыс.Пересылки—Реакции3Комментарии—
- Просмотры1,56 тыс.Пересылки—Реакции4Комментарии—
Новые посты
Просмотры607−52%к среднему
Пересылки—
Реакции—
Комментарии—
Просмотры743−41%к среднему
Пересылки—
Реакции2
Комментарии—
Просмотры788−38%к среднему
Пересылки—
Реакции3
Комментарии—
Просмотры925−27%к среднему
Пересылки—
Реакции1
Комментарии—
Просмотры1 050−17%к среднему
Пересылки—
Реакции2
Комментарии—
Просмотры1 300+3%к среднему
Пересылки—
Реакции4
Комментарии—
Просмотры1 310+3%к среднему
Пересылки—
Реакции4
Комментарии—
Просмотры1 230−3%к среднему
Пересылки—
Реакции4
Комментарии—
Просмотры1 290+2%к среднему
Пересылки—
Реакции—
Комментарии—
Просмотры1 260−1%к среднему
Пересылки—
Реакции4
Комментарии—