File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,18 +106,15 @@ Then open `http://localhost:8000`.
106106### Refs
107107
108108``` tsx | pure
109- import React from ' react' ;
110- import Input , {
111- TextArea ,
112- type InputRef ,
113- type TextAreaRef ,
114- } from ' @rc-component/input' ;
115-
116- const inputRef = React .useRef <InputRef >(null );
117- const textareaRef = React .useRef <TextAreaRef >(null );
118-
119- inputRef .current ?.focus ();
120- textareaRef .current ?.blur ();
109+ import type { InputRef , TextAreaRef } from ' @rc-component/input' ;
110+
111+ function focusInput(inputRef : InputRef | null ) {
112+ inputRef ?.focus ();
113+ }
114+
115+ function blurTextArea(textareaRef : TextAreaRef | null ) {
116+ textareaRef ?.blur ();
117+ }
121118```
122119
123120| Ref | Methods |
Original file line number Diff line number Diff line change @@ -106,18 +106,15 @@ npm start
106106### Refs
107107
108108``` tsx | pure
109- import React from ' react' ;
110- import Input , {
111- TextArea ,
112- type InputRef ,
113- type TextAreaRef ,
114- } from ' @rc-component/input' ;
115-
116- const inputRef = React .useRef <InputRef >(null );
117- const textareaRef = React .useRef <TextAreaRef >(null );
118-
119- inputRef .current ?.focus ();
120- textareaRef .current ?.blur ();
109+ import type { InputRef , TextAreaRef } from ' @rc-component/input' ;
110+
111+ function focusInput(inputRef : InputRef | null ) {
112+ inputRef ?.focus ();
113+ }
114+
115+ function blurTextArea(textareaRef : TextAreaRef | null ) {
116+ textareaRef ?.blur ();
117+ }
121118```
122119
123120| Ref | 方法 |
You can’t perform that action at this time.
0 commit comments