Search code examples
c#blazorsingle-page-applicationserver-side-renderingblazor-server-side

Is Blazor server SSR and SPA?


I heard that the Blazor server is SSR(server-side rendering). By the way, I know that the Blazor server is a single page apps (SPA). Is the Blazor server both SSR and SPA? Then, does the Blazor server first receive data through SSR method and then receive data through CSR method to implement the SPA?


Solution

  • It depends on your definitions.

    Blazor Server is Server Side Rendering. All the work goes on the server. It builds an html page which it passes to the client. JS client takes over, refreshes the page and then sends requests and gets bits of the page back from the server to render when they change. All the heavy lifting takes place on the server.

    Blazor WASM is Client Side Rendering. The client gets a load of JS and WASM files and a small html page. It has to execute client side code to put it all together and build the page.

    Both are Single Page Applications - the initially loaded page is the application. The client side code just changes out bits of the DOM to update a "page" or move between "pages".

    "Pages" are components, not html pages.