react-codemod
Version:
React codemod scripts
21 lines (17 loc) • 518 B
JavaScript
// for this file we disable the `pure-component` option
// so we should not convert to a plain class
var React = require('React');
var ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin');
var ComponentWithOnlyPureRenderMixin = React.createClass({
mixins: [ReactComponentWithPureRenderMixin],
getInitialState: function() {
return {
counter: this.props.initialNumber + 1,
};
},
render: function() {
return (
<div>{this.state.counter}</div>
);
},
});