.NET Conf 2023 - Day 1 Blazor 개요 정리
아래의 동영상에서,
.NET Conf 2023 - Day 1
; https://youtu.be/xEFO1sQ2bUc?t=5853
본 내용을 개인적인 흥미로 간략하게 정리한 것입니다.
.NET 8의 Blazor는 기존의 "Server", "WebAssembly" 모드에 이어 새롭게 "Static SSR" 모드를 지원한다고 합니다. 이 모드의 특징은,
* Scale (WebSocket을 사용하지 않으므로.)
* Presenting Information
* Navigation (links)
* Forms
등이 가능하고,
x Rich interactivity (all events handlers)
x Real-time updates
가 불가능합니다. 대신 위의 2가지 사항에 대해서는 부가적으로 기존의 Server, WebAssembly 모드를 섞어 해결할 수 있습니다.
 
설정도 단순히, @rendermode를 통해 가능합니다.
@rendermode InteractiveServer // by WebSocket
@rendermode InteractiveWebAssembly
@rendermode InteractiveAuto
그리고, 아래와 같은 특징의 "Streaming SSR" 모드를 지원하고,
Skip waiting for database/API calls
* Fast initial UI render/update
* Begin loading static resources in parallel
! Requires UI design to make sense
  * Use when data loading is likely to take multiple seconds
코드에서는 간략하게 "@attribute [StreamRendering]"를 추가하는 것으로 그 효과를 볼 수 있습니다.
@page "/timercounter"
@attribute [StreamRendering]
<p>
   The count is: @count
</p>
@code {
    int count;
    protected override async Task OnInitializedAsync()
    {
        for (var i = 0; i < 5; i ++)
        {
            await Task.Dealy(1000);
            count ++;
            StateHasChanged(); // Only needed to show intermediate states
        }
    }
}
"Enhanced navigation"과 함께,
 Get SPA-like responsiveness without needing a SPA
* Faster page loads with fewer HTTP requests
* Retain most DOM elements
* Enable/disable on any DOM subtree
  * On by default
  ! Consider disabling to reset JS state or navigating to non-Blazor pages
"Static SSR Forms"도 추가되었고,
Accept and validate input on static SSR pages
* All capabilities of