Checking if the component is mounted before perfom some animation