fixed switch between controlled and uncontrolled input fields

This commit is contained in:
Sebastian Sdorra
2018-07-27 10:29:22 +02:00
parent 70df3e043d
commit 387aa23cd4

View File

@@ -46,7 +46,10 @@ class UserForm extends React.Component<Props, State> {
}
componentDidMount() {
this.setState({ user: { ...this.props.user } });
const { user } = this.props;
if (user) {
this.setState({ user: { ...user } });
}
}
isValid = () => {