diff --git a/components/form/Form.jsx b/components/form/Form.jsx index 3825fb22e7..ef773bd9f4 100644 --- a/components/form/Form.jsx +++ b/components/form/Form.jsx @@ -1,5 +1,6 @@ import React from 'react'; import classNames from 'classnames'; +import PureRenderMixin from 'react-addons-pure-render-mixin'; export default class Form extends React.Component { static defaultProps = { @@ -22,6 +23,10 @@ export default class Form extends React.Component { form: React.PropTypes.object, } + shouldComponentUpdate(...args) { + return PureRenderMixin.shouldComponentUpdate.apply(this, args); + } + getChildContext() { return { form: this.props.form, diff --git a/components/form/FormItem.jsx b/components/form/FormItem.jsx index 4eacd47a60..d2afad484a 100644 --- a/components/form/FormItem.jsx +++ b/components/form/FormItem.jsx @@ -1,9 +1,6 @@ import React from 'react'; import classNames from 'classnames'; - -function prefixClsFn(prefixCls, ...args) { - return args.map((s) => `${prefixCls}-${s}`).join(' '); -} +import PureRenderMixin from 'react-addons-pure-render-mixin'; export default class FormItem extends React.Component { static defaultProps = { @@ -28,6 +25,10 @@ export default class FormItem extends React.Component { form: React.PropTypes.object, } + shouldComponentUpdate(...args) { + return PureRenderMixin.shouldComponentUpdate.apply(this, args); + } + getLayoutClass(colDef) { if (!colDef) { return ''; @@ -70,11 +71,10 @@ export default class FormItem extends React.Component { } renderHelp() { - const props = this.props; - const prefixCls = props.prefixCls; + const prefixCls = this.props.prefixCls; const help = this.getHelpMsg(); return help ? ( -