When should you use a CascadingParameter instead of a standard [Parameter], and what are the performance costs of deeply nested cascading values?
Last updated
Use a standard [Parameter] by default for explicit parent-to-child data. Use a
[CascadingParameter]for cross-cutting values (theme, current user,EditContext) needed deep in a subtree, to avoid threading them through every level.The cost is change propagation: when a
CascadingValuechanges, every subscribed descendant re-renders, so a frequently changing value near the root causes wide re-renders.Set
IsFixed="true"for values that never change (subscribers skip change tracking). Keep cascading values shallow and stable.
- https://medium.com/@quentinsims89/blazor-component-communication-mastering-parameters-and-cascading-parameters-6ac093023956
- https://www.pragimtech.com/blog/blazor/blazor-cascading-values-performance/
- https://learn.microsoft.com/en-us/aspnet/core/blazor/components/cascading-values-and-parameters?view=aspnetcore-10.0
- https://blazorise.com/blog/optimizing-rendering-and-reconciliation-in-large-blazor-apps
- https://www.youtube.com/watch?v=jBbTJujQNvo
- https://learn.microsoft.com/en-us/aspnet/core/blazor/performance/rendering?view=aspnetcore-10.0
- https://blazorise.com/blog