mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
Refs and the DOM: clarify when ref callbacks are invoked (#1069)
This commit is contained in:
committed by
Alex Krolick
parent
48cbb02dd2
commit
7f1b367eb6
@@ -251,7 +251,7 @@ class CustomTextInput extends React.Component {
|
||||
}
|
||||
```
|
||||
|
||||
React will call the `ref` callback with the DOM element when the component mounts, and call it with `null` when it unmounts. `ref` callbacks are invoked before `componentDidMount` or `componentDidUpdate` lifecycle hooks.
|
||||
React will call the `ref` callback with the DOM element when the component mounts, and call it with `null` when it unmounts. Refs are guaranteed to be up-to-date before `componentDidMount` or `componentDidUpdate` fires.
|
||||
|
||||
You can pass callback refs between components like you can with object refs that were created with `React.createRef()`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user