I'm using mat-tab in angular 10, and the components are rendering dynamically using ComponentFactoryResolver and pushing components in array using this method.
for ex:
componentArr.push(this.insertComponent(ProfileComponent));
componentArr.push(this.insertComponent(DataComponent));
componentArr.push(this.insertComponent(PaymentComponent));
private insertComponent<T>(component: any): T {
const componentFactory = this.componentFactoryResolver.resolveComponentFactory<T>(component);
return this.tabHost.viewContainerRef.createComponent<T>(componentFactory).instance;
}
Now I have one component which has very large data and it is making mat-tab lag while switching the tabs.
Which different approach should I try for this?