Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Razor Pages vs server-side Blazor

Tags:

c#

razor

blazor

Razor Pages is used for server side web applications, just like in the good old days.

Blazor is aiming to provide an alternative to popular JavaScript frameworks (like Angular or React), to create Single Page Applications (SPAs) which runs (mainly) in the clients browser.

However, I have also heard about server-side Blazor, which kind of confuses me. According to this answer, server side Blazor is just Razor Components running on the server. But what is the difference between Razor Pages and Razor Components?

Note: I am not trying to figure out which is better or "the right choice". I am simply trying to figure out which technical differences there are.

like image 916
Jakob Busk Sørensen Avatar asked Dec 10 '19 07:12

Jakob Busk Sørensen


Video Answer


1 Answers

Biggest difference is that razor pages renders on the server and sends whole pages to the client. Blazor server-side only sends the DOM changes over a signalr connection. So there are no page reloads. You need asp.net core running on the server for this technique.

Blazor webassembly is totally client side. Changes to the DOM are applied 'locally', this can be hosted from a static webserver.

like image 123
Flores Avatar answered Sep 23 '22 08:09

Flores