@@ -8,7 +8,7 @@ sidebar: tsLinks
88
99## \< /> Resolver { #Resolver }
1010
11- ``` typescript copy sandbox="https://codesandbox.io/s/react-hook-form-resolver-forked-mjsx7"
11+ ``` tsx copy sandbox="https://codesandbox.io/s/react-hook-form-resolver-forked-mjsx7"
1212import React from " react"
1313import { useForm , Resolver } from " react-hook-form"
1414
@@ -56,7 +56,7 @@ export default function App() {
5656
5757## \< /> SubmitHandler { #SubmitHandler }
5858
59- ``` typescript copy sandbox="https://codesandbox.io/s/react-hook-form-handlesubmit-ts-v7-z9z0g"
59+ ``` tsx copy sandbox="https://codesandbox.io/s/react-hook-form-handlesubmit-ts-v7-z9z0g"
6060import React from " react"
6161import { useForm , SubmitHandler } from " react-hook-form"
6262
@@ -86,7 +86,7 @@ export default function App() {
8686
8787## \< /> SubmitErrorHandler { #SubmitErrorHandler }
8888
89- ``` typescript copy
89+ ``` tsx copy
9090import React from " react"
9191import { useForm , SubmitHandler , SubmitErrorHandler } from " react-hook-form"
9292
@@ -104,8 +104,8 @@ export default function App() {
104104
105105 return (
106106 <form onSubmit = { handleSubmit (onSubmit , onError )} >
107- < input {...( register ("firstName ") , { required : true })} / >
108- < input {...( register ("lastName ") , { minLength : 2 })} / >
107+ <input { ... register (" firstName" , { required: true })} />
108+ <input { ... register (" lastName" , { minLength: 2 })} />
109109 <input type = " email" { ... register (" email" )} />
110110
111111 <input type = " submit" />
@@ -118,7 +118,7 @@ export default function App() {
118118
119119## \< /> Control { #Control }
120120
121- ``` typescript copy sandbox="https://codesandbox.io/s/control-2mg07"
121+ ``` tsx copy sandbox="https://codesandbox.io/s/control-2mg07"
122122import { useForm , useWatch , Control } from " react-hook-form"
123123
124124type FormValues = {
@@ -158,7 +158,7 @@ export default function App() {
158158
159159<TabGroup buttonLabels = { [" Type" , " Code Example" ]} >
160160
161- ``` typescript copy
161+ ``` tsx copy
162162export type UseFormReturn <
163163 TFieldValues extends FieldValues = FieldValues ,
164164 TContext = any ,
@@ -182,7 +182,7 @@ export type UseFormReturn<
182182}
183183` ` `
184184
185- ` ` ` typescript copy sandbox =" https://codesandbox.io/s/react-hook-form-UseFormReturn-forked-yl40u"
185+ ` ` ` tsx copy sandbox =" https://codesandbox.io/s/react-hook-form-UseFormReturn-forked-yl40u"
186186import type { FieldValues , UseFormReturn , SubmitHandler } from " react-hook-form"
187187import React from " react"
188188import { useForm } from " react-hook-form"
@@ -268,7 +268,7 @@ export default function App() {
268268
269269## \< /> UseFormProps { #UseFormProps }
270270
271- ```typescript copy
271+ ``` tsx copy
272272export type UseFormProps <
273273 TFieldValues extends FieldValues = FieldValues ,
274274 TContext extends object = object ,
@@ -296,7 +296,7 @@ export type UseFormProps<
296296
297297## \< /> UseFieldArrayReturn {#UseFieldArrayReturn}
298298
299- ` ` ` typescript copy
299+ ` ` ` tsx copy
300300export type UseFieldArrayReturn <
301301 TFieldValues extends FieldValues = FieldValues ,
302302 TFieldArrayName extends FieldArrayPath <TFieldValues > = FieldArrayPath <TFieldValues >,
@@ -346,7 +346,7 @@ export type UseFieldArrayProps<
346346
347347## \< /> UseControllerReturn {#UseControllerReturn}
348348
349- ` ` ` typescript copy
349+ ` ` ` tsx copy
350350export type UseControllerReturn <
351351 TFieldValues extends FieldValues = FieldValues ,
352352 TName extends FieldPath <TFieldValues > = FieldPath <TFieldValues >
@@ -361,7 +361,7 @@ export type UseControllerReturn<
361361
362362## \< /> UseControllerProps {#UseControllerProps}
363363
364- ` ` ` typescript copy
364+ ` ` ` tsx copy
365365export type UseControllerProps <
366366 TFieldValues extends FieldValues = FieldValues ,
367367 TName extends FieldPath <TFieldValues > = FieldPath <TFieldValues >
@@ -382,7 +382,7 @@ export type UseControllerProps<
382382
383383## \< /> FieldError {#FieldError}
384384
385- ` ` ` typescript copy
385+ ` ` ` tsx copy
386386export type FieldError = {
387387 type: LiteralUnion <keyof RegisterOptions , string >
388388 root? : FieldError
@@ -396,7 +396,7 @@ export type FieldError = {
396396
397397## \< /> FieldErrors {#FieldErrors}
398398
399- ` ` ` typescript copy
399+ ` ` ` tsx copy
400400export type FieldErrors <T extends FieldValues = FieldValues > = Partial <
401401 FieldValues extends IsAny <FieldValues >
402402 ? any
@@ -410,7 +410,7 @@ export type FieldErrors<T extends FieldValues = FieldValues> = Partial<
410410
411411## \< /> Field {#Field}
412412
413- ` ` ` typescript copy
413+ ` ` ` tsx copy
414414export type Field = {
415415 _f: {
416416 ref: Ref
@@ -427,7 +427,7 @@ export type Field = {
427427
428428์ด ํ์
์ ์ปค์คํ
์ปดํฌ๋ํธ์ ` name ` ์์ฑ์ ์ ์ํ ๋ ์ ์ฉํ๋ฉฐ, ํ๋ ๊ฒฝ๋ก์ ๋ํด ํ์
๊ฒ์ฌ๋ฅผ ์ํํฉ๋๋ค.
429429
430- ` ` ` typescript copy
430+ ` ` ` tsx copy
431431export type FieldPath <TFieldValues extends FieldValues > = Path <TFieldValues >
432432` ` `
433433
@@ -437,7 +437,7 @@ export type FieldPath<TFieldValues extends FieldValues> = Path<TFieldValues>
437437
438438์ด ํ์
์ ์ ๋ฌ๋ ๊ฐ๊ณผ ์ผ์นํ๋ ์ฌ์ฉ ๊ฐ๋ฅํ ๋ชจ๋ ๊ฒฝ๋ก์ ์ ๋์จ ํ์
์ ๋ฐํํฉ๋๋ค.
439439
440- ` ` ` typescript copy
440+ ` ` ` tsx copy
441441export type FieldPathByValue <TFieldValues extends FieldValues , TValue > = {
442442 [Key in FieldPath <TFieldValues >]: FieldPathValue <
443443 TFieldValues ,
@@ -452,15 +452,15 @@ export type FieldPathByValue<TFieldValues extends FieldValues, TValue> = {
452452
453453## \< /> FieldValues {#FieldValues}
454454
455- ` ` ` typescript copy
455+ ` ` ` tsx copy
456456export type FieldValues = Record <string , any >
457457` ` `
458458
459459---
460460
461461## \< /> FieldArrayWithId {#FieldArrayWithId}
462462
463- ` ` ` typescript copy
463+ ` ` ` tsx copy
464464export type FieldArrayWithId <
465465 TFieldValues extends FieldValues = FieldValues ,
466466 TFieldArrayName extends FieldArrayPath <TFieldValues > = FieldArrayPath <TFieldValues >,
@@ -472,7 +472,7 @@ export type FieldArrayWithId<
472472
473473## \< /> Mode {#Mode}
474474
475- ` ` ` typescript copy
475+ ` ` ` tsx copy
476476export type ValidationMode = typeof VALIDATION_MODE
477477
478478export type Mode = keyof ValidationMode
@@ -482,7 +482,7 @@ export type Mode = keyof ValidationMode
482482
483483## \< /> RegisterOptions {#RegisterOptions}
484484
485- ` ` ` typescript copy
485+ ` ` ` tsx copy
486486export type RegisterOptions <
487487 TFieldValues extends FieldValues = FieldValues ,
488488 TFieldName extends FieldPath <TFieldValues > = FieldPath <TFieldValues >
@@ -529,7 +529,7 @@ export type RegisterOptions<
529529
530530## \< /> FormStateProxy {#FormStateProxy}
531531
532- ` ` ` typescript copy
532+ ` ` ` tsx copy
533533export type FormStateProxy <TFieldValues extends FieldValues = FieldValues > = {
534534 isDirty: boolean
535535 isValidating: boolean
@@ -547,10 +547,10 @@ export type FormStateProxy<TFieldValues extends FieldValues = FieldValues> = {
547547
548548<TabGroup buttonLabels={["Code Example", "Type"]}>
549549
550- ` ` ` typescript copy sandbox = " https://codesandbox.io/s/react-hook-form-nestedvalue-lskdv"
550+ ` ` ` tsx copy sandbox =" https://codesandbox.io/s/react-hook-form-nestedvalue-lskdv"
551551import React from " react"
552552import { useForm , NestedValue } from " react-hook-form"
553- import { Autocomplete , TextField , Select } from " @material-ui/core"
553+ import { TextField , Select } from " @material-ui/core"
554554import { Autocomplete } from " @material-ui/lab"
555555
556556type Option = {
@@ -605,7 +605,7 @@ export default function App() {
605605
606606 <Select
607607 value = " "
608- onChange = {(e) => setValue(" muiSelect " , e.target.value as number [])}
608+ onChange = { (e ) => setValue (" select " , e .target .value as number [])}
609609 >
610610 <MenuItem value = { 10 } >Ten</MenuItem >
611611 <MenuItem value = { 20 } >Twenty</MenuItem >
@@ -617,7 +617,7 @@ export default function App() {
617617}
618618```
619619
620- ` ` ` typescript copy
620+ ``` tsx copy
621621import { useForm , NestedValue } from " react-hook-form"
622622
623623type FormValues = {
0 commit comments