diff --git a/js/adslot.js b/js/adslot.js index c1b903c..6fa1d4f 100644 --- a/js/adslot.js +++ b/js/adslot.js @@ -49,7 +49,9 @@ export class AdSlot extends React.Component { slotId: this.props.slotId || null, className: this.props.className || '', }; - this.adElementRef = React.createRef ? React.createRef() : null; + this.adElementRef = React.createRef ? React.createRef() : (element) => { + this.adElementRef = element; + }; } componentDidMount() { diff --git a/lib/adslot.js b/lib/adslot.js index 1609229..5468f17 100644 --- a/lib/adslot.js +++ b/lib/adslot.js @@ -66,7 +66,9 @@ function (_React$Component) { slotId: _this.props.slotId || null, className: _this.props.className || '' }; - _this.adElementRef = _react.default.createRef ? _react.default.createRef() : null; + _this.adElementRef = _react.default.createRef ? _react.default.createRef() : function (element) { + _this.adElementRef = element; + }; return _this; }