1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

Update form's email state if the email prop changes

This commit is contained in:
Brett Sun 2015-12-16 15:17:47 +01:00
parent 0da3891d51
commit f4227e9906
2 changed files with 16 additions and 0 deletions

View File

@ -41,6 +41,14 @@ let ConsignForm = React.createClass({
};
},
componentWillReceiveProps(nextProps) {
if (this.props.email !== nextProps.email) {
this.setState({
email: nextProps.email
});
}
},
getFormData() {
return this.props.id;
},

View File

@ -61,6 +61,14 @@ let LoanForm = React.createClass({
};
},
componentWillReceiveProps(nextProps) {
if (this.props.email !== nextProps.email) {
this.setState({
email: nextProps.email
});
}
},
onChange(state) {
this.setState(state);
},