What is the use of @key directive?

Platform: Blazor|Category: Components

The @key directive is important when creating components dynamically by iterating list/IEnumerable. Adding the @key will ensure proper change detection and UI update in the collection of components.

Reference link: https://blazor-university.com/components/render-trees/optimising-using-key/