diff --git a/src/ResponsiveEmbed.js b/src/ResponsiveEmbed.js index bde5a3ab76..8f78d2b969 100644 --- a/src/ResponsiveEmbed.js +++ b/src/ResponsiveEmbed.js @@ -5,7 +5,7 @@ import warning from 'warning'; class ResponsiveEmbed extends React.Component { render() { - const { bsClass, className, a16by9, a4by3, ...props } = this.props; + const { bsClass, className, a16by9, a4by3, children, ...props } = this.props; warning(!(!a16by9 && !a4by3), '`a16by9` or `a4by3` attribute must be set.'); warning(!(a16by9 && a4by3), 'Either `a16by9` or `a4by3` attribute can be set. Not both.'); @@ -16,13 +16,10 @@ class ResponsiveEmbed extends React.Component { return (
- {cloneElement( - this.props.children, - { - ...props, - className: classNames(className, 'embed-responsive-item') - } - )} + {cloneElement(children, { + ...props, + className: classNames(className, 'embed-responsive-item') + })}
); }