Skip to content

Commit

Permalink
Remove handleChangeValue completely
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpalmer committed Nov 28, 2017
1 parent 55565e4 commit e9d0b10
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/formik.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ export interface FormikHandlers {
handleChange: (e: React.ChangeEvent<any>) => void;
/** Mark input as touched */
handleBlur: (e: any) => void;
/** Change value of form field directly */
handleChangeValue: (name: string, value: any) => void;
/** Reset form event handler */
handleReset: () => void;
}
Expand Down Expand Up @@ -410,22 +408,6 @@ export class Formik<
}
};

handleChangeValue = (field: string, value: any) => {
if (process.env.NODE_ENV !== 'production') {
console.warn(
`Warning: Formik\'s handleChangeValue is deprecated and may be removed in future releases. Use Formik's setFieldValue(field, value) and setFieldTouched(field, isTouched) instead. React will merge the updates under the hood and avoid a double render. For more info see https://github.com/jaredpalmer/formik#setfieldvalue-field-string-value-any--void`
);
}
// Set touched and form fields by name
this.setState(prevState => ({
...prevState,
values: setDeep(field, value, prevState.values),
touched: setDeep(field, true, prevState.touched),
}));

this.runValidationSchema(setDeep(field, value, this.state.values));
};

setFieldValue = (field: string, value: any) => {
// Set form field by name
this.setState(
Expand Down

0 comments on commit e9d0b10

Please sign in to comment.