Skip to content

Commit 91b3aba

Browse files
committed
update
1 parent b0139d4 commit 91b3aba

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • src/routes/reference/jsx-attributes

src/routes/reference/jsx-attributes/ref.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ description: >-
2424

2525
- **Type:** variable binding or callback function
2626

27-
Receives the rendered element or forwarded ref value.
27+
For DOM elements, variable refs are assigned during render and callback refs receive the element.
2828

2929
## Behavior
3030

3131
- Refs are assigned during rendering before the element is connected to the DOM.
3232
- A variable ref assigns the rendered element to the referenced variable.
33-
- A callback ref is called with the rendered element.
34-
- Component refs work only when the component forwards the `ref` prop to an underlying element or child component.
33+
- A callback ref is called with the rendered element. When `ref` comes through a spread, functional refs are invoked from the spread handling path instead.
34+
- Component refs work only when the component uses or forwards the `ref` prop to an underlying element or child component.
3535

3636
## Examples
3737

@@ -64,3 +64,7 @@ function App() {
6464
return <MyComp ref={myDiv} />;
6565
}
6666
```
67+
68+
## Related
69+
70+
- [`onMount`](/reference/lifecycle/on-mount)

0 commit comments

Comments
 (0)