Skip to content

Commit c41dec2

Browse files
committed
Remove <NextMajor> callouts
1 parent 59ab8cd commit c41dec2

26 files changed

+52
-295
lines changed

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

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,11 @@ export default function CatFriends() {
258258
const map = getMap();
259259
if (node) {
260260
map.set(cat, node);
261-
} else {
262-
map.delete(cat);
263261
}
262+
263+
return () => {
264+
map.delete(cat);
265+
};
264266
}}
265267
>
266268
<img src={cat} />
@@ -323,28 +325,6 @@ li {
323325

324326
In this example, `itemsRef` doesn't hold a single DOM node. Instead, it holds a [Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map) from item ID to a DOM node. ([Refs can hold any values!](/learn/referencing-values-with-refs)) The [`ref` callback](/reference/react-dom/components/common#ref-callback) on every list item takes care to update the Map:
325327

326-
```js
327-
<li
328-
key={cat.id}
329-
ref={node => {
330-
const map = getMap();
331-
if (node) {
332-
// Add to the Map
333-
map.set(cat, node);
334-
} else {
335-
// Remove from the Map
336-
map.delete(cat);
337-
}
338-
}}
339-
>
340-
```
341-
342-
This lets you read individual DOM nodes from the Map later.
343-
344-
<NextMajor>
345-
346-
Starting in React 19, callback refs can return a cleanup function. When the cleanup function is provided, React will not call the `ref` callback with `null` and call the cleanup function instead:
347-
348328
```js
349329
<li
350330
key={cat.id}
@@ -361,7 +341,7 @@ Starting in React 19, callback refs can return a cleanup function. When the clea
361341
>
362342
```
363343

364-
</NextMajor>
344+
This lets you read individual DOM nodes from the Map later.
365345

366346
</DeepDive>
367347

src/content/reference/react-dom/client/createRoot.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ An app fully built with React will usually only have one `createRoot` call for i
4545
4646
* **optional** `options`: An object with options for this React root.
4747
48-
* <NextMajorBadge title="This feature is available in React 19 beta and the React canary channel" /> **optional** `onCaughtError`: Callback called when React catches an error in an Error Boundary. Called with the `error` caught by the Error Boundary, and an `errorInfo` object containing the `componentStack`.
49-
* <NextMajorBadge title="This feature is available in React 19 beta and the React canary channel" /> **optional** `onUncaughtError`: Callback called when an error is thrown and not caught by an Error Boundary. Called with the `error` that was thrown, and an `errorInfo` object containing the `componentStack`.
48+
* **optional** `onCaughtError`: Callback called when React catches an error in an Error Boundary. Called with the `error` caught by the Error Boundary, and an `errorInfo` object containing the `componentStack`.
49+
* **optional** `onUncaughtError`: Callback called when an error is thrown and not caught by an Error Boundary. Called with the `error` that was thrown, and an `errorInfo` object containing the `componentStack`.
5050
* **optional** `onRecoverableError`: Callback called when React automatically recovers from errors. Called with an `error` React throws, and an `errorInfo` object containing the `componentStack`. Some recoverable errors may include the original error cause as `error.cause`.
5151
* **optional** `identifierPrefix`: A string prefix React uses for IDs generated by [`useId`.](/reference/react/useId) Useful to avoid conflicts when using multiple roots on the same page.
5252
@@ -346,14 +346,6 @@ It is uncommon to call `render` multiple times. Usually, your components will [u
346346
347347
### Show a dialog for uncaught errors {/*show-a-dialog-for-uncaught-errors*/}
348348
349-
<NextMajor>
350-
351-
`onUncaughtError` is available in React 19 beta, and the React canary channel.
352-
353-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
354-
355-
</NextMajor>
356-
357349
By default, React will log all uncaught errors to the console. To implement your own error reporting, you can provide the optional `onUncaughtError` root option:
358350
359351
```js [[1, 6, "onUncaughtError"], [2, 6, "error", 1], [3, 6, "errorInfo"], [4, 10, "componentStack"]]
@@ -596,12 +588,6 @@ export default function App() {
596588
597589
### Displaying Error Boundary errors {/*displaying-error-boundary-errors*/}
598590
599-
<Canary>
600-
601-
`onCaughtError` is only available in the latest React Canary release.
602-
603-
</Canary>
604-
605591
By default, React will log all errors caught by an Error Boundary to `console.error`. To override this behavior, you can provide the optional `onCaughtError` root option to handle errors caught by an [Error Boundary](/reference/react/Component#catching-rendering-errors-with-an-error-boundary):
606592
607593
```js [[1, 6, "onCaughtError"], [2, 6, "error", 1], [3, 6, "errorInfo"], [4, 10, "componentStack"]]

src/content/reference/react-dom/client/hydrateRoot.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ React will attach to the HTML that exists inside the `domNode`, and take over ma
4141
4242
* **optional** `options`: An object with options for this React root.
4343
44-
* <NextMajorBadge title="This feature is available in React 19 beta and the React canary channel" /> **optional** `onCaughtError`: Callback called when React catches an error in an Error Boundary. Called with the `error` caught by the Error Boundary, and an `errorInfo` object containing the `componentStack`.
45-
* <NextMajorBadge title="This feature is available in React 19 beta and the React canary channel" /> **optional** `onUncaughtError`: Callback called when an error is thrown and not caught by an Error Boundary. Called with the `error` that was thrown and an `errorInfo` object containing the `componentStack`.
44+
* **optional** `onCaughtError`: Callback called when React catches an error in an Error Boundary. Called with the `error` caught by the Error Boundary, and an `errorInfo` object containing the `componentStack`.
45+
* **optional** `onUncaughtError`: Callback called when an error is thrown and not caught by an Error Boundary. Called with the `error` that was thrown and an `errorInfo` object containing the `componentStack`.
4646
* **optional** `onRecoverableError`: Callback called when React automatically recovers from errors. Called with the `error` React throws, and an `errorInfo` object containing the `componentStack`. Some recoverable errors may include the original error cause as `error.cause`.
4747
* **optional** `identifierPrefix`: A string prefix React uses for IDs generated by [`useId`.](/reference/react/useId) Useful to avoid conflicts when using multiple roots on the same page. Must be the same prefix as used on the server.
4848
@@ -376,14 +376,6 @@ It is uncommon to call [`root.render`](#root-render) on a hydrated root. Usually
376376
377377
### Show a dialog for uncaught errors {/*show-a-dialog-for-uncaught-errors*/}
378378
379-
<NextMajor>
380-
381-
`onUncaughtError` is currently available in React 19 beta, and the React canary channel.
382-
383-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
384-
385-
</NextMajor>
386-
387379
By default, React will log all uncaught errors to the console. To implement your own error reporting, you can provide the optional `onUncaughtError` root option:
388380
389381
```js [[1, 7, "onUncaughtError"], [2, 7, "error", 1], [3, 7, "errorInfo"], [4, 11, "componentStack"]]
@@ -630,12 +622,6 @@ export default function App() {
630622
631623
### Displaying Error Boundary errors {/*displaying-error-boundary-errors*/}
632624
633-
<Canary>
634-
635-
`onCaughtError` is only available in the latest React Canary release.
636-
637-
</Canary>
638-
639625
By default, React will log all errors caught by an Error Boundary to `console.error`. To override this behavior, you can provide the optional `onCaughtError` root option for errors caught by an [Error Boundary](/reference/react/Component#catching-rendering-errors-with-an-error-boundary):
640626
641627
```js [[1, 7, "onCaughtError"], [2, 7, "error", 1], [3, 7, "errorInfo"], [4, 11, "componentStack"]]

src/content/reference/react-dom/components/common.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -246,45 +246,42 @@ These events fire for resources like [`<audio>`](https://developer.mozilla.org/e
246246
Instead of a ref object (like the one returned by [`useRef`](/reference/react/useRef#manipulating-the-dom-with-a-ref)), you may pass a function to the `ref` attribute.
247247

248248
```js
249-
<div ref={(node) => console.log(node)} />
249+
<div ref={(node) => {
250+
console.log('Attached', node);
251+
252+
return () => {
253+
console.log('Clean up', node)
254+
}
255+
}}>
250256
```
251257

252258
[See an example of using the `ref` callback.](/learn/manipulating-the-dom-with-refs#how-to-manage-a-list-of-refs-using-a-ref-callback)
253259

254-
When the `<div>` DOM node is added to the screen, React will call your `ref` callback with the DOM `node` as the argument. When that `<div>` DOM node is removed, React will call your `ref` callback with `null`.
260+
When the `<div>` DOM node is added to the screen, React will call your `ref` callback with the DOM `node` as the argument. When that `<div>` DOM node is removed, React will call your the cleanup function returned from the callback.
255261

256262
React will also call your `ref` callback whenever you pass a *different* `ref` callback. In the above example, `(node) => { ... }` is a different function on every render. When your component re-renders, the *previous* function will be called with `null` as the argument, and the *next* function will be called with the DOM node.
257263

258264
#### Parameters {/*ref-callback-parameters*/}
259265

260-
* `node`: A DOM node or `null`. React will pass you the DOM node when the ref gets attached, and `null` when the `ref` gets detached. Unless you pass the same function reference for the `ref` callback on every render, the callback will get temporarily detached and re-attached during every re-render of the component.
266+
* `node`: A DOM node. React will pass you the DOM node when the ref gets attached. Unless you pass the same function reference for the `ref` callback on every render, the callback will get temporarily cleanup and re-create during every re-render of the component.
261267

262-
<NextMajor>
268+
<Note>
263269

264-
#### Returns {/*returns*/}
265-
In React 19 beta, ref callbacks can return a cleanup function. When a cleanup function is provided, React will not call the `ref` callback with `null` and will call the cleanup function instead.
270+
#### React 19 added cleanup functions for `ref` callbacks. {/*react-19-added-cleanup-functions-for-ref-callbacks*/}
266271

267-
* **optional** `cleanup function`: When the `ref` is detached, React will call the cleanup function. If a function is not returned by the `ref` callback, React will call the callback again with `null` as the argument when the `ref` gets detached.
272+
To support backwards compatibility, if a cleanup function is not returned from the `ref` callback, `node` will be called with `null` when the `ref` is detached. This behavior will be removed in a future version.
268273

269-
```js
274+
</Note>
270275

271-
<div ref={(node) => {
272-
console.log(node);
273-
274-
return () => {
275-
console.log('Clean up', node)
276-
}
277-
}}>
276+
#### Returns {/*returns*/}
278277

279-
```
278+
* **optional** `cleanup function`: When the `ref` is detached, React will call the cleanup function. If a function is not returned by the `ref` callback, React will call the callback again with `null` as the argument when the `ref` gets detached. This behavior will be removed in a future version.
280279

281280
#### Caveats {/*caveats*/}
282281

283282
* When Strict Mode is on, React will **run one extra development-only setup+cleanup cycle** before the first real setup. This is a stress-test that ensures that your cleanup logic "mirrors" your setup logic and that it stops or undoes whatever the setup is doing. If this causes a problem, implement the cleanup function.
284283
* When you pass a *different* `ref` callback, React will call the *previous* callback's cleanup function if provided. If not cleanup function is defined, the `ref` callback will be called with `null` as the argument. The *next* function will be called with the DOM node.
285284

286-
</NextMajor>
287-
288285
---
289286

290287
### React event object {/*react-event-object*/}

src/content/reference/react-dom/components/form.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22
title: "<form>"
33
---
44

5-
<NextMajor>
6-
7-
React's extensions to `<form>` are currently available in React 19 beta and React's canary and experimental channels.
8-
9-
In stable releases of React, `<form>` works only as a [built-in browser HTML component](https://react.dev/reference/react-dom/components#all-html-components).
10-
11-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
12-
13-
</NextMajor>
14-
15-
165
<Intro>
176

187
The [built-in browser `<form>` component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) lets you create interactive controls for submitting information.

src/content/reference/react-dom/components/input.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22
title: "<input>"
33
---
44

5-
<NextMajor>
6-
7-
React's extensions to the `formAction` prop of `<input>` is currently available in React 19 beta and the React canary channel.
8-
9-
In stable releases of React, `<input>` works only as a [built-in browser HTML component](https://react.dev/reference/react-dom/components#all-html-components).
10-
11-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
12-
13-
</NextMajor>
14-
155
<Intro>
166

177
The [built-in browser `<input>` component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) lets you render different kinds of form inputs.
@@ -42,7 +32,7 @@ To display an input, render the [built-in browser `<input>`](https://developer.m
4232

4333
`<input>` supports all [common element props.](/reference/react-dom/components/common#props)
4434

45-
- <NextMajorBadge title="This feature is only available in React 19 beta and the React Canary channel"/> [`formAction`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formaction): A string or function. Overrides the parent `<form action>` for `type="submit"` and `type="image"`. When a URL is passed to `action` the form will behave like a standard HTML form. When a function is passed to `formAction` the function will handle the form submission. See [`<form action>`](/reference/react-dom/components/form#props).
35+
- [`formAction`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formaction): A string or function. Overrides the parent `<form action>` for `type="submit"` and `type="image"`. When a URL is passed to `action` the form will behave like a standard HTML form. When a function is passed to `formAction` the function will handle the form submission. See [`<form action>`](/reference/react-dom/components/form#props).
4636

4737
You can [make an input controlled](#controlling-an-input-with-a-state-variable) by passing one of these props:
4838

src/content/reference/react-dom/components/link.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22
link: "<link>"
33
---
44

5-
<NextMajor>
6-
7-
React's extensions to `<link>` are currently available in React 19 beta and the React canary channel.
8-
9-
In stable releases of React `<link>` works only as a [built-in browser HTML component](https://react.dev/reference/react-dom/components#all-html-components).
10-
11-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
12-
13-
</NextMajor>
14-
155
<Intro>
166

177
The [built-in browser `<link>` component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link) lets you use external resources such as stylesheets or annotate the document with link metadata.

src/content/reference/react-dom/components/meta.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22
meta: "<meta>"
33
---
44

5-
<NextMajor>
6-
7-
React's extensions to `<meta>` are currently available in React 19 beta and the React canary channel.
8-
9-
In stable releases of React `<meta>` works only as a [built-in browser HTML component](https://react.dev/reference/react-dom/components#all-html-components).
10-
11-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
12-
13-
</NextMajor>
14-
15-
165
<Intro>
176

187
The [built-in browser `<meta>` component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta) lets you add metadata to the document.

src/content/reference/react-dom/components/script.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22
script: "<script>"
33
---
44

5-
<NextMajor>
6-
7-
React's extensions to `<script>` are currently available in React 19 beta and the React canary channel.
8-
9-
In stable releases of React `<script>` works only as a [built-in browser HTML component](https://react.dev/reference/react-dom/components#all-html-components).
10-
11-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
12-
13-
</NextMajor>
14-
155
<Intro>
166

177
The [built-in browser `<script>` component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) lets you add a script to your document.

src/content/reference/react-dom/components/style.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22
style: "<style>"
33
---
44

5-
<NextMajor>
6-
7-
React's extensions to `<style>` are currently available in React 19 beta and the React canary channel.
8-
9-
In stable releases of React `<style>` works only as a [built-in browser HTML component](https://react.dev/reference/react-dom/components#all-html-components).
10-
11-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
12-
13-
</NextMajor>
14-
155
<Intro>
166

177
The [built-in browser `<style>` component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style) lets you add inline CSS stylesheets to your document.

src/content/reference/react-dom/components/title.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22
title: "<title>"
33
---
44

5-
<NextMajor>
6-
7-
React's extensions to `<title>` are currently available in React 19 beta and the React canary channels.
8-
9-
In stable releases of React `<title>` works only as a [built-in browser HTML component](https://react.dev/reference/react-dom/components#all-html-components).
10-
11-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
12-
13-
</NextMajor>
14-
15-
165
<Intro>
176

187
The [built-in browser `<title>` component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title) lets you specify the title of the document.

src/content/reference/react-dom/hooks/index.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ The `react-dom` package contains Hooks that are only supported for web applicati
1212

1313
## Form Hooks {/*form-hooks*/}
1414

15-
<NextMajor>
16-
17-
Form Hooks are currently available in React 19 beta and the React canary channel.
18-
19-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
20-
21-
</NextMajor>
22-
2315
*Forms* let you create interactive controls for submitting information. To manage forms in your components, use one of these Hooks:
2416

2517
* [`useFormStatus`](/reference/react-dom/hooks/useFormStatus) allows you to make updates to the UI based on the status of the a form.

src/content/reference/react-dom/hooks/useFormStatus.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ title: useFormStatus
33
canary: true
44
---
55

6-
<NextMajor>
7-
8-
The `useFormStatus` Hook is currently available in React 19 beta and the React canary channel.
9-
10-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
11-
12-
</NextMajor>
13-
146
<Intro>
157

168
`useFormStatus` is a Hook that gives you status information of the last form submission.

src/content/reference/react-dom/preconnect.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
title: preconnect
33
---
44

5-
<NextMajor>
6-
7-
The `preconnect` function is available in React 19 beta and the React Canary channel.
8-
9-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
10-
11-
</NextMajor>
12-
135
<Intro>
146

157
`preconnect` lets you eagerly connect to a server that you expect to load resources from.

src/content/reference/react-dom/prefetchDNS.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
title: prefetchDNS
33
---
44

5-
<NextMajor>
6-
7-
The `prefetchDNS` function is currently available in React 19 beta and the React canary channel.
8-
9-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
10-
11-
</NextMajor>
12-
135
<Intro>
146

157
`prefetchDNS` lets you eagerly look up the IP of a server that you expect to load resources from.

src/content/reference/react-dom/preinit.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
title: preinit
33
---
44

5-
<NextMajor>
6-
7-
The `preinit` function is currently available in React 19 beta and the React canary channel.
8-
9-
Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
10-
11-
</NextMajor>
12-
135
<Note>
146

157
[React-based frameworks](/learn/start-a-new-react-project) frequently handle resource loading for you, so you might not have to call this API yourself. Consult your framework's documentation for details.

0 commit comments

Comments
 (0)