From 30f7d9314229c8af08c94e913f3f7754de532df0 Mon Sep 17 00:00:00 2001
From: Matt Browne
Date: Sat, 27 Apr 2024 19:51:28 -0400
Subject: [PATCH 1/2] docs: add note to Controller documentation
---
src/content/docs/usecontroller/controller.mdx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/content/docs/usecontroller/controller.mdx b/src/content/docs/usecontroller/controller.mdx
index 1d9d010bc..54c0c3c0e 100644
--- a/src/content/docs/usecontroller/controller.mdx
+++ b/src/content/docs/usecontroller/controller.mdx
@@ -8,6 +8,8 @@ sidebar: apiLinks
React Hook Form embraces uncontrolled components and native inputs, however it's hard to avoid working with external controlled component such as [React-Select](https://github.com/JedWatson/react-select), [AntD](https://github.com/ant-design/ant-design) and [MUI](https://mui.com/). This wrapper component will make it easier for you to work with them.
+**Note:** if you simply want to control a field's value from outside the form, it's not necessary to use `Controller`. You can simply use the [`values`](/docs/useform#values) option of `useForm`.
+
### Props
---
From 8f0218b1dc411e552b1b2c668ea6d6c89b69b776 Mon Sep 17 00:00:00 2001
From: Matt Browne
Date: Sat, 27 Apr 2024 20:23:58 -0400
Subject: [PATCH 2/2] docs: add note to useController page as well
---
src/data/api.tsx | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/data/api.tsx b/src/data/api.tsx
index 2b49afe99..5beca204d 100644
--- a/src/data/api.tsx
+++ b/src/data/api.tsx
@@ -787,11 +787,7 @@ setValue('test', '')
Set to true during validation.
>
),
- validatingFields: (
- <>
- Capture fields which are getting async validation.
- >
- ),
+ validatingFields: <>Capture fields which are getting async validation.>,
},
errors: {
title: "errors",
@@ -2936,6 +2932,15 @@ const { field: checkbox } = useController({ name: 'test1' })
Controller. It's useful for creating reusable Controlled
input.
+
+ Note: if you simply want to control a field's value
+ from outside the form, it's not necessary to use{" "}
+ useController. You can simply use the{" "}
+
+ values
+ {" "}
+ option of useForm.
+