Generate hook code for remove component