Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
default as ReactComponentWithPureRenderMixin,
} from 'react-addons-pure-render-mixin';
import Prism from 'prismjs';
export default class Code extends Component {
static propTypes = {
className: PropTypes.string,
code: PropTypes.string,
};
componentDidMount() {
this._highlight();
}
shouldComponentUpdate = ReactComponentWithPureRenderMixin.shouldComponentUpdate;
componentDidUpdate() {
this._highlight();
}
_highlight() {
Prism.highlightElement(this.refs.code);
}
render() {
const className = (this.props.language ? `language-${this.props.language}` : '');
return (
<code></code>