Fix InputField controlled / uncontrolled mode

This commit is contained in:
Chi Vinh Le
2018-05-07 18:26:37 +02:00
parent 802a3bd656
commit 06abccabb4
2 changed files with 9 additions and 5 deletions
@@ -14,7 +14,11 @@ const initialState = {
editing: false,
showErrors: true,
errors: {},
formData: {},
formData: {
oldPassword: '',
newPassword: '',
confirmNewPassword: '',
},
};
class ChangePassword extends React.Component {
@@ -19,13 +19,13 @@ const InputField = ({
showSuccess = false,
validationType = '',
icon = '',
value = '',
defaultValue = '',
value,
defaultValue,
disabled = false,
}) => {
const inputValue = {
...(value ? { value } : {}),
...(defaultValue ? { defaultValue } : {}),
...(value !== undefined ? { value } : {}),
...(defaultValue !== undefined ? { defaultValue } : {}),
};
return (