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
Copy file name to clipboardexpand all lines: content/en/guide/v10/hooks.md
+49-2
Original file line number
Diff line number
Diff line change
@@ -265,7 +265,11 @@ const onClick = useCallback(
265
265
266
266
> Fun fact: `useCallback(fn, deps)` is equivalent to `useMemo(() => fn, deps)`.
267
267
268
-
## useRef
268
+
## Refs
269
+
270
+
**Ref**erences are stable, local values that persist across rerenders but don't cause rerenders themselves. See [Refs](/guide/v10/refs) for more information & examples.
271
+
272
+
### useRef
269
273
270
274
To create a stable reference to a DOM node or a value that persists between renders, we can use the `useRef` hook. It works similarly to [createRef](/guide/v10/refs#createref).
> Be careful not to confuse `useRef` with `createRef`.
294
298
295
-
> See [Refs](/guide/v10/refs) for more information & examples.
299
+
### useImperativeHandle
300
+
301
+
To mutate a ref that is passed into a child component we can use the `useImperativeHandle` hook. It takes three arguments: the ref to mutate, a function to execute that will return the new ref value, and a dependency array to determine when to rerun.
0 commit comments