react-dom#unstable_renderSubtreeIntoContainer JavaScript Examples
The following examples show how to use
react-dom#unstable_renderSubtreeIntoContainer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SuggestionWrapper.react.js From spring-boot-ecommerce with Apache License 2.0 | 5 votes |
SuggestionWrapper = function (_React$Component) {
_inherits(SuggestionWrapper, _React$Component);
function SuggestionWrapper() {
_classCallCheck(this, SuggestionWrapper);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
SuggestionWrapper.prototype.componentDidMount = function componentDidMount() {
this.renderOrReady();
};
SuggestionWrapper.prototype.componentDidUpdate = function componentDidUpdate() {
this.renderOrReady();
};
SuggestionWrapper.prototype.renderOrReady = function renderOrReady() {
if (IS_REACT_16) {
this.props.renderReady();
} else {
this.renderComponent();
}
};
SuggestionWrapper.prototype.renderComponent = function renderComponent() {
var _props = this.props,
children = _props.children,
container = _props.container,
renderReady = _props.renderReady;
unstable_renderSubtreeIntoContainer(this, children, container, function callback() {
if (renderReady) {
renderReady.call(this);
}
});
};
SuggestionWrapper.prototype.render = function render() {
if (IS_REACT_16) {
var _props2 = this.props,
children = _props2.children,
container = _props2.container;
return createPortal(children, container);
}
return null;
};
return SuggestionWrapper;
}(React.Component)