How do you handle component lifecycle hooks and change detection optimization in modern frontend frameworks?