Live Chat Icon For mobile
Live Chat Icon

What about performance when using cascading values in Blazor?

Platform: Blazor| Category: Components

When a cascading value is changed, the new value will be sent down the component tree and all components that use it will be updated. Therefore, Blazor has to keep a watch on the value continuously. This takes up resources and, in a large application, could end up causing performance issues.

If the cascading value will never change, we can stop keeping watch continuously. There is a IsFixed parameter in the CascadingValue component. It is set to false by default but if set it to true, Blazor will not monitor it for changes.

<CascadingValue Value="@Id" Name="EmpId" IsFixed="true">
	<CascadingValue Value="@Name" Name="EmpName" IsFixed="true">
    	<CascadingChild OnNameChange="@ChangeName"></CascadingChild>
    	<CascadingChild1></CascadingChild1>
	</CascadingValue>
</CascadingValue>

Reference link: https://chrissainty.com/understanding-cascading-values-and-cascading-parameters/

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.