Reputation: 51
I read a lot about it on different websites, and I still don't really know how the project structure will have to look. For now I have 3 different projects :
project
project.Client
project.Shared
some people said to keep interactive ssr components on the server, and the interactive wasm/auto on the client. On the other hand, my smart online friend (lol) said :
**In the Interactive Auto Blazor Web App template, the client project is indeed minimal and doesn't hold components directly. Instead, its primary role is to provide the WebAssembly runtime environment for client-side interactivity once the app transitions from server-side rendering to WebAssembly.**
.
Also, program.cs of the client project is very light, which made me believe there shouldn't be any component :
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddBlazorBootstrap();
await builder.Build().RunAsync();
Also, my shared project only holds one custom data validation attribute , which I don't even know if it's correct to hold it there.
As you can see, I'm very confused about this template, but it looks interesting to me how you can load pages fast using SSR and then changing to CSR, instead of just sticking with one the whole time. Help would be much appreciated.
Upvotes: 1
Views: 100
Reputation: 8616
If you check the dependencies of server project you will find it referenced the "client project".
This means all components could be placed in "client project" (SSR, ServerInterActive,WASM, Auto). Because "server project" can always use these referenced pages.
By contrast, this dependency is only one-way : Client project cannot use components in "server project". So if the page need "client render" (WASM, auto), you have to put it in the client project.
The shared project is more like a class library which is referenced by both client and server project.
Upvotes: 1