C
C#9mo ago
hunterlan

Root - level cascading value and parameter

According to official documentation(https://learn.microsoft.com/en-us/aspnet/core/blazor/components/cascading-values-and-parameters?view=aspnetcore-8.0), I can create a cascading parameter like that: builder.Services.AddCascadingValue(sp => new CascadingValueSource<UserState>(new UserState(), isFixed: false)); And then use it like that: [CascadingParameter] public UserState UserState { get; set; } And our variable UserState shouldn't be null, right? I have a Blazor Web App project (InteractiveAuto) and unfortunately, UserState for me is null. I called AddCascadingValue to both projects and it's still null. I don't understand what I am doing wrong.
ASP.NET Core Blazor cascading values and parameters
Learn how to flow data from an ancestor Razor component to descendent components.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server