Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 692 Bytes

no-access-control.md

File metadata and controls

37 lines (25 loc) · 692 Bytes

Avoid accessing the properties of control (no-access-control)

Do not access any of the properties inside the object control directly. It's for internal usage only.

Rule Details

Examples of incorrect code for this rule:

function Component() {
  const { control } = useForm();
  console.log(control.defaultValuesRef);
  // ...
}

Examples of correct code for this rule:

function Component() {
  const { control } = useForm();
  const { fields } = useFieldArray({ control, name: "test" });
  // ...
}

Options

NA

When Not To Use It

NA

Further Reading

Document of React Hook Form - control