How to use the react-addons-pure-render-mixin.default.shouldComponentUpdate function in react-addons-pure-render-mixin

To help you get started, we’ve selected a few react-addons-pure-render-mixin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github draft-js-plugins / draft-js-plugins / site / components / CodeHighlight / index.js View on Github external
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>

react-addons-pure-render-mixin

>**Note:** >This is a legacy React addon, and is no longer maintained. > >We don't encourage using it in new code, but it exists for backwards compatibility. >The recommended migration path is to use [`React.PureComponent`](https://facebook.github.io/re

MIT
Latest version published 4 years ago

Package Health Score

78 / 100
Full package analysis