I have implemented a same component more than once in one of my forms. I have to send data from parent to child components. I know that it can be achieved with @input or with viewchild. what is the performance issue of using one over the other? when should i use viewchild or input?
When you are using @Input()
, for every change the ngOnChanges()
will be called and causes more noise.
Using ViewChild()
will not create any such noise. So, prefer using Viewchild over @Input()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With