C
C#2y ago
Shiv

❔ What makes Blazor a SPA?

Guys, I am new to blazor and heard Blazor is a Single page application. What architecture change made that a spa and can we make SPA using asp.net core web app without using any front end framework? Please guide
16 Replies
Angius
Angius2y ago
Uh, it's not really about an architecture change? An SPA is... an SPA, single page, no reload Pretty sure even Webforms back in the day could do it Blazor is just the thing Microsoft made for SPAs, that's about all there is to it Sure, WASM and SignalR did help, as did the transition from .NET Framework to .NET, but I don't think there have been any architectural changes that's make SPAs possible in particular
✿ Scarlet ✿
Just make sure you don't have any new page And there is: a spa
Shiv
ShivOP2y ago
Thank you @ZZZZZZZZZZZZZZZZZZZZZZZZZ and @puppytamer , Usually in the .net core MVC app the complete layout will reload if we select any page, Can we avoid that? I ended up using sammy.js for one of our app for avoiding full page reload.. But blazor looks fine for this..
Angius
Angius2y ago
Javascript is one way, yes
Shiv
ShivOP2y ago
Did they solve this issue using blazor was my doubt...
✿ Scarlet ✿
Yes, it will not reload unless you use force reload objects like submit buttons
Angius
Angius2y ago
Blazor Server uses some JS in the background to provide the SPA functionality Blazor WASM uses, well, WASM instead of JS
Murphy
Murphy2y ago
You don't have to use Blazor as an SPA. In fact, if you try to deal with more specialized authentication and extend the built-in Identity and try to use Blazor for your authentication-related pages, it's not really possible to keep everything in a single Blazor page. When a page with Blazor first loads, it'll do a regular web request and sets up the circuit to the server. That's the only 'actual' web request that happens, which is what makes it an SPA. So some of the function provided by the Identity managers won't work exactly as expected (ie SignInAsyc won't work) until you navigate while setting forceLoad to bypass client-side routing to set up a new circuit.
Shiv
ShivOP2y ago
Yes got the context ...
Murphy
Murphy2y ago
As long as you NavigateTo() routable components (components with @page "asdf") then the client-side router will keep you on the same 'page' without reloading.
Shiv
ShivOP2y ago
so it will navigate to routable components not pages right ? underlying there will be a single page?
Murphy
Murphy2y ago
Yup.
JakenVeina
JakenVeina2y ago
without using any front end framework?
Blazor IS the frontend framework whichever flavor of Blazor you're talking about, it includes a very large package of JS code that makes it all work you're just not writing any JS yourself
✿ Scarlet ✿
The API is better than react btw
Shiv
ShivOP2y ago
OK got your point ... I meant react,angular etc:)
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?