react-ssr-critical-styles
Version:
critical style hocs for react
17 lines (13 loc) • 340 B
JavaScript
import React from 'react';
export default class extends React.Component {
static propTypes = {
styleId: React.PropTypes.string,
};
componentDidMount() {
const $style = document.getElementById(this.props.styleId);
if ($style) $style.parentNode.removeChild($style);
}
render() {
return this.props.children;
}
}