Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to tell Blazor to not Rerender childComponent

I have a dynamicly own tabs on c#,Html,css and some Js.
Js just toggle style "Display" to block or none.
Tabs generate with foreach.

Example:

foreach (item in TabsList){<div@RenderFragment/<div}

Main problem: In my tabs there are some actions and data and I dont want to lose it when I Add or Delete other Tab. If I add new Tab then it will normal render without ReRender old tabs and lose data, but if I Remove from List tab which located to the left of the current selected tab then Blazor will ReRender all my Tabs and I will lose My Data. But if i remove tab to the right of the current selected tab Blazor will not ReRender All my Tabs.
Is it Possible tell Blazor just remove item from TabsList and not to Rerender again my component?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

This might be solvable with the @key attribute.
Without a [mre] it’s not possible to be sure, you test it:

 foreach (item in TabsList){ <div @key="item">@RenderFragment</div }
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading