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
docs(react-dom): fix async and defer script attribute descriptions
- Fix async: was incorrectly described as deferring execution (defer behavior)
Now correctly: fetched in parallel, evaluated as soon as available (out of order)
- Fix defer: was incorrectly typed as string, now boolean
Clarified: fetched in parallel, executed after document loads (in order)
Fixes#7328
Copy file name to clipboardExpand all lines: src/content/reference/react-dom/components/script.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ It should have *either* `children` or a `src` prop.
40
40
41
41
Other supported props:
42
42
43
-
*`async`: a boolean. Allows the browser to defer execution of the script until the rest of the document has been processed — the preferred behavior for performance.
43
+
*`async`: a boolean. Scripts are fetched in parallel to parsing and evaluated as soon as they are available (potentially out of order) — the preferred behavior for performance.
44
44
*`crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`.
45
45
*`fetchPriority`: a string. Lets the browser rank scripts in priority when fetching multiple scripts at the same time. Can be `"high"`, `"low"`, or `"auto"` (the default).
46
46
*`integrity`: a string. A cryptographic hash of the script, to [verify its authenticity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
@@ -57,7 +57,7 @@ Props that disable React's [special treatment of scripts](#special-rendering-beh
57
57
Props that are **not recommended** for use with React:
58
58
59
59
*`blocking`: a string. If set to `"render"`, instructs the browser not to render the page until the scriptsheet is loaded. React provides more fine-grained control using Suspense.
60
-
*`defer`: a string. Prevents the browser from executing the script until the document is done loading. Not compatible with streaming server-rendered components. Use the `async` prop instead.
60
+
*`defer`: a boolean. Scripts are fetched in parallel to parsing but deferred from execution until the document has finished loading (in document order). Not compatible with streaming server-rendered components. Use the `async` prop instead.
61
61
62
62
#### Special rendering behavior {/*special-rendering-behavior*/}
0 commit comments