Angular Performance Optimization - *ngFor trackBy
Yet another blog post dedicated to Angular performance optimizations.
This time we will use the trackBy
function of the *ngFor
structural directive to optimize changes made to the DOM tree and thus optimize performances when updating a large list of items.
The use case is still a simple web application that displays a list of books. Now, a form will let the user insert a book in the list, and Delete buttons will let the user remove items from the list: