C
C#9mo ago
Paulvv

Blazor Wasm with blazor server or API

I'm new to blazor and want to work with it. But i have a question about blazor. i see alot of tutorials using WASM with an API. Even in .net you have rendermode auto (so you could use both Blazor WASM and Server). Why do people use API instead of Blazor Server? And what are the advantages of using an API or the advantages of using a blazor server?
2 Replies
universalappco
universalappco9mo ago
Blazor Server requires a constant websocket connect for interactivity. The UI changes are rendered on the server and then the DOM elements replaced on the page. WASM runs fully in the browser. If you want to offload processing to the users browser WASM can be a good choice, it should give the fastest experience on capable hardware. It's a lot closer to developing mobile or windows apps in a lot of ways. In the new "Blazor Web App" Template I would store anything that needs to run in Auto or WASM rending mode in the Client project that is created for you - As you pointed out, when running WASM you need to call to your backend API to save changes to the database etc. If a component has a lot of interactivity that would benefit from running client side, you might prefer that over Blazor Server rendering.
Paulvv
Paulvv9mo ago
Thanks you for your answer. I much clearer to me now! 👍
Want results from more Discord servers?
Add your server