You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Call`useImperativeHandle`at the top level of your component to customize the ref handle it exposes:
23
+
Викличте`useImperativeHandle`на верхньому рівні вашого компонента, щоб кастомізувати об'єкт посилання, який повертає реф:
24
24
25
25
```js
26
26
import { useImperativeHandle } from'react';
27
27
28
28
functionMyInput({ ref }) {
29
29
useImperativeHandle(ref, () => {
30
30
return {
31
-
// ... your methods ...
31
+
// ... ваші методи ...
32
32
};
33
33
}, []);
34
34
// ...
35
35
```
36
36
37
-
[See more examples below.](#usage)
37
+
[Перегляньте більше прикладів нижче.](#usage)
38
38
39
-
#### Parameters {/*parameters*/}
39
+
#### Параметри {/*parameters*/}
40
40
41
-
* `ref`: The `ref` you received as a prop to the`MyInput` component.
41
+
* `ref`: `Реф`, який ви отримали як проп у компоненті`MyInput`.
42
42
43
43
* `createHandle`: A function that takes no arguments and returns the ref handle you want to expose. That ref handle can have any type. Usually, you will return an object with the methods you want to expose.
0 commit comments