Skip to content

Instantly share code, notes, and snippets.

@suzdalnitski
Created August 12, 2018 23:45
Show Gist options
  • Save suzdalnitski/e3529b0f94651da25fb110db1a9d5f07 to your computer and use it in GitHub Desktop.
Save suzdalnitski/e3529b0f94651da25fb110db1a9d5f07 to your computer and use it in GitHub Desktop.
import { withStateHandlers, compose } from "recompose";
const initialState = {
email: { value: "" },
password: { value: "" },
confirmPassword: { value: "" }
};
const onChangeEmail = props => event => ({
email: {
value: event.target.value,
isDirty: true
}
});
const onChangePassword = props => event => ({
password: {
value: event.target.value,
isDirty: true
}
});
const onChangeConfirmPassword = props => event => ({
confirmPassword: {
value: event.target.value,
isDirty: true
}
});
const withTextFieldState = withStateHandlers(initialState, {
onChangeEmail,
onChangePassword,
onChangeConfirmPassword
});
export default withTextFieldState;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment