Generate hook code for create component