Skip to content

Commit

Permalink
update references to canary/r19
Browse files Browse the repository at this point in the history
  • Loading branch information
noahlemen committed May 2, 2024
1 parent 48573b0 commit a5bbeba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/content/learn/manipulating-the-dom-with-refs.md
Expand Up @@ -361,7 +361,7 @@ Starting in React 19, callback refs can return a cleanup function. When the clea
>
```

When [Strict Mode](/reference/react/StrictMode) is on in canary and experimental channels, [React detaches and re-attaches DOM refs](/reference/react/StrictMode#fixing-bugs-found-by-cleaning-up-and-re-attaching-dom-refs-in-development). This will stress-test callbacks like the one above by calling its cleanup function before calling the callback a second time.
When [Strict Mode](/reference/react/StrictMode) is on in React 19, [React detaches and re-attaches DOM refs](/reference/react/StrictMode#fixing-bugs-found-by-cleaning-up-and-re-attaching-dom-refs-in-development). This will stress-test callbacks like the one above by calling its cleanup function before calling the callback a second time.
</NextMajor>
</DeepDive>

Expand Down
10 changes: 5 additions & 5 deletions src/content/reference/react/StrictMode.md
Expand Up @@ -44,7 +44,7 @@ Strict Mode enables the following development-only behaviors:

- Your components will [re-render an extra time](#fixing-bugs-found-by-double-rendering-in-development) to find bugs caused by impure rendering.
- Your components will [re-run Effects an extra time](#fixing-bugs-found-by-re-running-effects-in-development) to find bugs caused by missing Effect cleanup.
- <CanaryBadge title="This feature is only available in the Canary channel" /> Your components will [detach and re-attach refs to components](#fixing-bugs-found-by-cleaning-up-and-re-attaching-dom-refs-in-development) to find bugs caused by missing ref cleanup.
- <NextMajorBadge title="This feature is available in React 19 beta and the React canary channel" /> Your components will [detach and re-attach refs to components](#fixing-bugs-found-by-cleaning-up-and-re-attaching-dom-refs-in-development) to find bugs caused by missing ref cleanup.
- Your components will [be checked for usage of deprecated APIs.](#fixing-deprecation-warnings-enabled-by-strict-mode)

#### Props {/*props*/}
Expand Down Expand Up @@ -88,7 +88,7 @@ Strict Mode enables the following checks in development:

- Your components will [re-render an extra time](#fixing-bugs-found-by-double-rendering-in-development) to find bugs caused by impure rendering.
- Your components will [re-run Effects an extra time](#fixing-bugs-found-by-re-running-effects-in-development) to find bugs caused by missing Effect cleanup.
- <CanaryBadge title="This feature is only available in the Canary channel" /> Your components will [detach and re-attach refs to components](#fixing-bugs-found-by-cleaning-up-and-re-attaching-dom-refs-in-development) to find bugs caused by missing ref cleanup.
- <NextMajorBadge title="This feature is available in React 19 beta and the React canary channel" /> Your components will [detach and re-attach refs to components](#fixing-bugs-found-by-cleaning-up-and-re-attaching-dom-refs-in-development) to find bugs caused by missing ref cleanup.
- Your components will [be checked for usage of deprecated APIs.](#fixing-deprecation-warnings-enabled-by-strict-mode)

**All of these checks are development-only and do not impact the production build.**
Expand Down Expand Up @@ -829,15 +829,15 @@ Without Strict Mode, it was easy to miss that your Effect needed cleanup. By run
---
### Fixing bugs found by detaching and re-attaching refs to components in development {/*fixing-bugs-found-by-cleaning-up-and-re-attaching-dom-refs-in-development*/}
<Canary>
In canary and experimental channels, React will run an extra setup+cleanup cycle in development for refs to components, much like it does for Effects.
<NextMajor>
In React 19, React will run an extra setup+cleanup cycle in development for refs to components, much like it does for Effects.
React will detach refs to components that were created via `useRef` by setting `ref.current` to `null` before setting it to the DOM node or handle.
For [`ref` callbacks](/reference/react-dom/components/common#ref-callback), React will call the callback function with the DOM node or handle as its argument. It will then call the callback's [cleanup function](reference/react-dom/components/common#returns) before calling the `ref` callback function again with the DOM node as its argument.
You can read more about refs in [Manipulating the DOM with Refs.](/learn/manipulating-the-dom-with-refs)
</Canary>
</NextMajor>
---
### Fixing deprecation warnings enabled by Strict Mode {/*fixing-deprecation-warnings-enabled-by-strict-mode*/}
Expand Down

0 comments on commit a5bbeba

Please sign in to comment.