I don`t understand your comment. 
What is meaning of "old kind"?
This function is to replace the current kind of the component.