Skip to content

Commit

Permalink
Fix value cannot change when user passes onChange prop
Browse files Browse the repository at this point in the history
  • Loading branch information
codeaholicguy committed Oct 20, 2016
1 parent 559edac commit d77542a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/FormsyText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ const FormsyText = React.createClass({
}
}

this.setState({ value: event.currentTarget.value });

// Controlled component
if (this.props.onChange) {
this.props.onChange(event, event.currentTarget.value);
// Uncontrolled component
} else {
this.setState({ value: event.currentTarget.value });
}
},

Expand Down

0 comments on commit d77542a

Please sign in to comment.