title: Reactjs TypeError: Cannot read property 'style' of undefined
body: <p>How do I interpret the following error?</p>
  
  <blockquote>
    <p>TypeError: Cannot read property 'style' of undefined</p>
  </blockquote>
  
  <pre><code>import React from 'react';
  import PropTypes from 'prop-types';
  import {VelocityComponent} from 'velocity-react';
  import 'velocity-animate/velocity.ui';
  
  const FuseAnimate = (props) =&gt; {
      const children = React.cloneElement(props.children, {
          style: { // this line throws the error
              ...props.children.style,
              visibility: 'hidden'
          }
      });
      return (
          &lt;VelocityComponent {...props} children={children}/&gt;
      )
  
  };
  
  FuseAnimate.propTypes = {
      children: PropTypes.element.isRequired
  };
  
  FuseAnimate.defaultProps = {
      animation          : 'transition.fadeIn',
      runOnMount         : true,
      targetQuerySelector: null,
      interruptBehavior  : 'stop',
      visibility         : 'visible',
      duration           : 300,
      delay              : 50,
      easing             : [0.4, 0.0, 0.2, 1],
      display            : null
  };
  
  export default FuseAnimate;
  </code></pre>