Skip to content

Commit 521e746

Browse files
authored
docs: fix code examples in advanced-usage.mdx (#1177)
1 parent 033aa2f commit 521e746

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/content/advanced-usage.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ function App() {
381381

382382
<Input {...register("input")} />
383383

384-
<button type="button" onClick={() => reset({ defaultValues })}>
384+
<button type="button" onClick={() => reset({ ...defaultValues })}>
385385
Reset
386386
</button>
387387
<input type="submit" />
@@ -408,7 +408,7 @@ function App() {
408408
const onSubmit = (data) => console.log(data)
409409

410410
useEffect(() => {
411-
register({ name: "select" })
411+
register("select")
412412
}, [register])
413413

414414
const handleChange = (e) => setValue("select", e.target.value)
@@ -521,7 +521,12 @@ const items = Array.from(Array(1000).keys()).map((i) => ({
521521
const WindowedRow = memo(({ index, style, data }) => {
522522
const { register } = useFormContext()
523523

524-
return <input {...register(`${index}.quantity`)} />
524+
return (
525+
<div style={style}>
526+
<label>{data[index].title}</label>
527+
<input {...register(`${index}.quantity`)} />
528+
</div>
529+
)
525530
})
526531

527532
export const App = () => {

0 commit comments

Comments
 (0)