Skip to content

Commit 3b99118

Browse files
authored
docs: fix dead link on manipulating-the-dom-with-refs.md
1 parent 02f1c61 commit 3b99118

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/content/learn/manipulating-the-dom-with-refs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default function Form() {
7979

8080
1. 使用 `useRef` Hook 声明 `inputRef`
8181
2.`<input ref={inputRef}>` 这样传递它。这告诉 React **将这个 `<input>` 的 DOM 节点放入 `inputRef.current`**
82-
3.`handleClick` 函数中,从 `inputRef.current` 读取 input DOM 节点并使用 `inputRef.current.focus()` 调用它的 [`focus()`](https://developer.mozilla.org/zh-CN/docs/Web/API/HTMLElement/focus)
82+
3.`handleClick` 函数中,从 `inputRef.current` 读取 input DOM 节点并使用 `inputRef.current.focus()` 调用它的 [`focus()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus)
8383
4.`onClick``handleClick` 事件处理器传递给 `<button>`
8484

8585
虽然 DOM 操作是 ref 最常见的用例,但 `useRef` Hook 可用于存储 React 之外的其他内容,例如计时器 ID 。与 state 类似,ref 能在渲染之间保留。你甚至可以将 ref 视为设置它们时不会触发重新渲染的 state 变量!你可以在[使用 Ref 引用值](/learn/referencing-values-with-refs)中了解有关 ref 的更多信息。

0 commit comments

Comments
 (0)