Skip to content

Commit

Permalink
reduce variable
Browse files Browse the repository at this point in the history
  • Loading branch information
bluebill1049 committed Jun 7, 2020
1 parent 6a78200 commit cfac2cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/useForm.ts
Expand Up @@ -836,9 +836,8 @@ export function useForm<
ref,
...validateOptions,
};
const fields = fieldsRef.current;
const isRadioOrCheckbox = isRadioOrCheckboxFunction(ref);
let field = fields[name] as Field;
let field = fieldsRef.current[name] as Field;
let isEmptyDefaultValue = true;
let isFieldArray;
let defaultValue;
Expand All @@ -852,7 +851,7 @@ export function useForm<
})
: ref === field.ref)
) {
fields[name] = {
fieldsRef.current[name] = {
...field,
...validateOptions,
};
Expand Down Expand Up @@ -884,7 +883,7 @@ export function useForm<
field = fieldRefAndValidationOptions;
}

fields[name] = field;
fieldsRef.current[name] = field;

if (!isEmptyObject(defaultValuesRef.current)) {
defaultValue = get(defaultValuesRef.current, name);
Expand Down

0 comments on commit cfac2cf

Please sign in to comment.