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 trigger an analytic when component gets re-rendered?

I need to trigger an analytic when a component gets re-rendered because someones searches in the search bar. When someone searches, the component LibraryManager gets re-rendered to address that search value. I need to trigger an analytic when that component gets re-rendered. The best way to trigger that analytic is in the render function but I’m told not to add the trigger to the render function because of side effects. Is there another function I can use to add the analytics trigger in lit?

>Solution :

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

If calling the analytic instance from the render method is not possible, you can listen to the onChange event of the search bar input. When the change event is fired, you’ll make the analytics call in the callback function.

Just make sure that if you subscribe to the event, to also unsubscribe if necessary.

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