Skip to content

Commit ae38a69

Browse files
committed
Translate up to line 107
1 parent 88138f1 commit ae38a69

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/content/reference/react/useImperativeHandle.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ const MyInput = forwardRef(function MyInput(props, ref) {
8080
});
8181
```
8282
83-
Note that in the code above, the `ref` is no longer forwarded to the `<input>`.
83+
上記のコードでは、`ref` `<input>` に受け渡しされなくなっていることに注意してください。
8484
85-
For example, suppose you don't want to expose the entire `<input>` DOM node, but you want to expose two of its methods: `focus` and `scrollIntoView`. To do this, keep the real browser DOM in a separate ref. Then use `useImperativeHandle` to expose a handle with only the methods that you want the parent component to call:
85+
例えば、`<input>` DOM ノード全体を公開するのではなく、その 2 つのメソッド、`focus` `scrollIntoView` を公開したいとします。これを行うには、実際のブラウザの DOM を別の ref に保持します。そして、`useImperativeHandle` を使用して、親コンポーネントに呼び出したいメソッドのみを含むハンドルを公開します。
8686
8787
```js {7-14}
8888
import { forwardRef, useRef, useImperativeHandle } from 'react';

0 commit comments

Comments
 (0)