Checking if the component is mounted before perfom an animation