Skip to content

Commit 033aa2f

Browse files
authored
docs: fix typos and syntax errors in FAQ documentation (#1176)
1 parent f6a038d commit 033aa2f

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/content/faqs.mdx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,11 @@ export default function App() {
168168
const onSubmit = (data) => console.log(data)
169169
const { ref, ...rest } = register("firstName")
170170
const onClick = () => {
171-
firstNameRef.current!.value = ""
171+
firstNameRef.current.value = ""
172172
}
173173

174174
useImperativeHandle(ref, () => firstNameRef.current)
175175

176-
177176
return (
178177
<form onSubmit={handleSubmit(onSubmit)}>
179178
<input {...rest} ref={firstNameRef} />
@@ -207,7 +206,7 @@ export default function App() {
207206
useEffect(() => {
208207
register("firstName", { required: true })
209208
register("lastName")
210-
}, [])
209+
}, [register])
211210

212211
return (
213212
<form onSubmit={handleSubmit(onSubmit)}>
@@ -240,18 +239,11 @@ Make sure you are not using `value`. The correct property is `defaultValue`.
240239

241240
React Hook Form is focusing on uncontrolled inputs, which means you don't need to change the input `value` via `state` via `onChange`. In fact, you don't need `value` at all. You only need to set `defaultValue` for the initial input value.
242241

243-
```javascript
244-
import { useForm } from "react-hook-form/dist/index.ie11" // V6
245-
import { useForm } from "react-hook-form/dist/react-hook-form.ie11" // V5'
246-
// Resolvers
247-
import { yupResolver } from "@hookform/resolvers/dist/ie11/yup"
248-
```
249-
250242
---
251243

252244
## React Hook Form, Formik or Redux Form? {#ReactHookFormFormikorReduxForm}
253245

254-
First of all, all libs try to solve the same problem: make the form building experience as easy as possible. However, there are some fundamental differences between these three. `react-hook-form` is built with uncontrolled inputs in mind and tries to provide your form with the best performance and least amount of re-renders possible. Additionallly, `react-hook-form` is built with React Hooks and used as a hook, which means there is no Component for you to import. Here are some of the detailed differences:
246+
First of all, all libs try to solve the same problem: make the form building experience as easy as possible. However, there are some fundamental differences between these three. `react-hook-form` is built with uncontrolled inputs in mind and tries to provide your form with the best performance and least amount of re-renders possible. Additionally, `react-hook-form` is built with React Hooks and used as a hook, which means there is no Component for you to import. Here are some of the detailed differences:
255247

256248
| | React Hook Form | Formik | Redux Form |
257249
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
@@ -303,7 +295,7 @@ It's important to understand that React Hook Form embraces native form behavior
303295
- [Modal form and toggle inputs example](https://codesandbox.io/s/react-hook-form-modal-form-conditional-inputs-c7n0r)
304296
- [Tab form example](https://codesandbox.io/s/tabs-760h9)
305297

306-
Alternatively you can use the deprecated option `shouldUnregister: false` when calling \`useForm\`.
298+
Alternatively you can use the deprecated option `shouldUnregister: false` when calling `useForm`.
307299

308300
<TabGroup buttonLabels={["Controller", "Custom Register"]}>
309301

0 commit comments

Comments
 (0)