❔ 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
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
Just make sure you don't have any new page
And there is: a spa
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..
Javascript is one way, yes
Did they solve this issue using blazor was my doubt...
Yes, it will not reload unless you use force reload objects like submit buttons
Blazor Server uses some JS in the background to provide the SPA functionality
Blazor WASM uses, well, WASM instead of JS
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.
Yes got the context ...
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.
so it will navigate to routable components not pages right ?
underlying there will be a single page?
Yup.
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
The API is better than react btw
OK got your point ... I meant react,angular etc:)
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.