react-frame-component
Version:
React component to wrap your application or component in an iFrame for encapsulation purposes
23 lines (18 loc) • 539 B
JSX
import React, { Component, Children } from 'react'; // eslint-disable-line no-unused-vars
import PropTypes from 'prop-types';
export default class Content extends Component {
static propTypes = {
children: PropTypes.element.isRequired,
contentDidMount: PropTypes.func.isRequired,
contentDidUpdate: PropTypes.func.isRequired
};
componentDidMount() {
this.props.contentDidMount();
}
componentDidUpdate() {
this.props.contentDidUpdate();
}
render() {
return Children.only(this.props.children);
}
}