Prevent multiple rendering with PureRenderMixin

Creating a new instance of error triggers two additional rendering when typing in an input, using same instance prevent it to happen.
This commit is contained in:
Greg Bergé 2015-10-28 12:48:46 +01:00
parent 300a53f172
commit 6bcdb61b27
1 changed files with 2 additions and 1 deletions

View File

@ -7,6 +7,7 @@ var Mixin = require('./Mixin.js');
var HOC = require('./HOC.js');
var Decorator = require('./Decorator.js');
var options = {};
var emptyArray = [];
Formsy.Mixin = Mixin;
Formsy.HOC = HOC;
@ -277,7 +278,7 @@ Formsy.Form = React.createClass({
error: (function () {
if (isValid && !isRequired) {
return [];
return emptyArray;
}
if (validationResults.errors.length) {