What are named cascading values, and why would you use them instead of a single unnamed CascadingValue?
Last updated
Unnamed cascading values are matched by type, so two values of the same type (e.g. two
strings) collide and the consumer can't pick one.Named values fix this: provide with
<CascadingValue Name="PrimaryColor">and consume with[CascadingParameter(Name = "PrimaryColor")].Typical use: supplying several related values of the same primitive type, such as multiple theme colors.
- https://chrissainty.com/understanding-cascading-values-and-cascading-parameters/
- https://blazor-university.com/components/cascading-values/cascading-values-by-type/
- https://medium.com/@quentinsims89/blazor-component-communication-mastering-parameters-and-cascading-parameters-6ac093023956
- https://learn.microsoft.com/en-us/aspnet/core/blazor/components/cascading-values-and-parameters?view=aspnetcore-10.0
- https://www.telerik.com/blogs/blazor-basics-component-parameters-state-management
- https://blazor-university.com/components/cascading-values/cascading-values-by-name/
- https://dev.to/stevsharp/mastering-blazor-component-communication-eventcallback-cascadingparameter-and-ref-explained-eig