Skip to content

Commit f6a038d

Browse files
ria-ahyoungria-ahyoungbluebill1049
authored
fix: Corrects broken legacy API links in version switcher (v6/v5) (#1173)
* fix: modify broken legacy API links in version tab (v6/v5) * chore: fix lint error in example code * chore: re-run prettier format (ci warning) --------- Co-authored-by: ria-ahyoung <[email protected]> Co-authored-by: Bill <[email protected]>
1 parent e32f239 commit f6a038d

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

src/components/ApiGallery.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function ApiGallery() {
1818

1919
if (version !== 7) {
2020
router.push(
21-
`https://react-hook-form-website-git-leagcy-hook-form.vercel.app/${version}/api`
21+
`https://react-hook-form-website-git-leagcy-hook-form.vercel.app/v${version}/api`
2222
)
2323
} else {
2424
router.push(`/v${version}/docs/`)

src/content/docs/useformstate/errormessage.mdx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,18 @@ export default function App() {
155155
```
156156

157157
```javascript copy sandbox="https://codesandbox.io/s/react-hook-form-v7-errormessage-multiple-error-messages-lnvkt"
158-
import { useForm } from "react-hook-form";
159-
import { ErrorMessage } from '@hookform/error-message';
160-
158+
import { useForm } from "react-hook-form"
159+
import { ErrorMessage } from "@hookform/error-message"
161160

162161
export default function App() {
163-
const { register, formState: { errors }, handleSubmit } = useForm({
164-
criteriaMode: "all"
165-
});
166-
const onSubmit = data => console.log(data);
162+
const {
163+
register,
164+
formState: { errors },
165+
handleSubmit,
166+
} = useForm({
167+
criteriaMode: "all",
168+
})
169+
const onSubmit = (data) => console.log(data)
167170

168171
return (
169172
<form onSubmit={handleSubmit(onSubmit)}>
@@ -172,12 +175,12 @@ export default function App() {
172175
required: "This is required.",
173176
pattern: {
174177
value: /d+/,
175-
message: "This input is number only."
178+
message: "This input is number only.",
176179
},
177180
maxLength: {
178181
value: 10,
179-
message: "This input exceed maxLength."
180-
}
182+
message: "This input exceed maxLength.",
183+
},
181184
})}
182185
/>
183186
<ErrorMessage
@@ -191,12 +194,10 @@ export default function App() {
191194
}
192195
/>
193196

194-
195197
<input type="submit" />
196198
</form>
197-
);
199+
)
198200
}
199-
200201
```
201202

202203
</TabGroup>

src/content/docs/usewatch/watch.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,31 @@ A React Hook Form component that provides the same functionality as `useWatch`,
2020
| `defaultValue` | <TypeText>unknown</TypeText> | default value for `useWatch` to return before the initial render.<br/><br/>**Note:** the first render will always return `defaultValue` when it's supplied. |
2121
| `disabled` | <TypeText>boolean = false</TypeText> | Option to disable the subscription. |
2222
| `exact` | <TypeText>boolean = false</TypeText> | This prop will enable an exact match for input name subscriptions. |
23-
| `render` | <TypeText>Function</TypeText> | Subscribes to specified form field(s) and re-renders its child function whenever the values change. This allows you to declaratively consume form values in JSX without manually wiring up state. |
23+
| `render` | <TypeText>Function</TypeText> | Subscribes to specified form field(s) and re-renders its child function whenever the values change. This allows you to declaratively consume form values in JSX without manually wiring up state. |
2424

2525
**Examples:**
2626

2727
---
2828

2929
```tsx copy sandbox=""
30-
import { useForm, Watch } from 'react-hook-form';
30+
import { useForm, Watch } from "react-hook-form"
3131

3232
const App = () => {
33-
const { register, control } = useForm();
33+
const { register, control } = useForm()
3434

3535
return (
3636
<div>
3737
<form>
38-
<input {...register('foo')} />
39-
<input {...register('bar')} />
38+
<input {...register("foo")} />
39+
<input {...register("bar")} />
4040
</form>
4141
{/* re-render only when value of `foo` changes */}
4242
<Watch
4343
control={control}
44-
names={['foo']}
44+
names={["foo"]}
4545
render={([foo]) => <span>{foo}</span>}
4646
/>
4747
</div>
48-
);
49-
};
48+
)
49+
}
5050
```

0 commit comments

Comments
 (0)