You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/packages/ui-default/components/react/DomComponent.jsx

27 lines
499 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
export default class DomComponent extends React.PureComponent {
componentDidMount() {
this.refs.dom.appendChild(this.props.childDom);
}
componentWillUnmount() {
$(this.refs.dom).empty();
}
render() {
const {
childDom,
...rest
} = this.props;
return (
<div {...rest} ref="dom"></div>
);
}
}
DomComponent.propTypes = {
childDom: PropTypes.instanceOf(HTMLElement).isRequired,
};