Skip to content

Commit c116c42

Browse files
authored
Remove mention of Suspensey <script /> (#6945)
1 parent 438ee7a commit c116c42

File tree

1 file changed

+6
-6
lines changed
  • src/content/reference/react-dom/components

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,10 @@ Props that are **not recommended** for use with React:
6868

6969
#### Special rendering behavior {/*special-rendering-behavior*/}
7070

71-
React can move `<script>` components to the document's `<head>`, de-duplicate identical scripts, and [suspend](/reference/react/Suspense) while the script is loading.
71+
React can move `<script>` components to the document's `<head>` and de-duplicate identical scripts.
7272

7373
To opt into this behavior, provide the `src` and `async={true}` props. React will de-duplicate scripts if they have the same `src`. The `async` prop must be true to allow scripts to be safely moved.
7474

75-
If you supply any of the `onLoad` or `onError` props, there is no special behavior, because these props indicate that you are managing the loading of the script manually within your component.
76-
7775
This special treatment comes with two caveats:
7876

7977
* React will ignore changes to props after the script has been rendered. (React will issue a warning in development if this happens.)
@@ -86,8 +84,10 @@ This special treatment comes with two caveats:
8684
### Rendering an external script {/*rendering-an-external-script*/}
8785

8886
If a component depends on certain scripts in order to be displayed correctly, you can render a `<script>` within the component.
87+
However, the component might be committed before the script has finished loading.
88+
You can start depending on the script content once the `load` event is fired e.g. by using the `onLoad` prop.
8989

90-
If you supply an `src` and `async` prop, your component will suspend while the script is loading. React will de-duplicate scripts that have the same `src`, inserting only one of them into the DOM even if multiple components render it.
90+
React will de-duplicate scripts that have the same `src`, inserting only one of them into the DOM even if multiple components render it.
9191

9292
<SandpackWithHTMLOutput>
9393

@@ -97,7 +97,7 @@ import ShowRenderedHTML from './ShowRenderedHTML.js';
9797
function Map({lat, long}) {
9898
return (
9999
<>
100-
<script async src="map-api.js" />
100+
<script async src="map-api.js" onLoad={() => console.log('script loaded')} />
101101
<div id="map" data-lat={lat} data-long={long} />
102102
</>
103103
);
@@ -120,7 +120,7 @@ When you want to use a script, it can be beneficial to call the [preinit](/refer
120120

121121
### Rendering an inline script {/*rendering-an-inline-script*/}
122122

123-
To include an inline script, render the `<script>` component with the script source code as its children. Inline scripts are not de-duplicated or moved to the document `<head>`, and since they don't load any external resources, they will not cause your component to suspend.
123+
To include an inline script, render the `<script>` component with the script source code as its children. Inline scripts are not de-duplicated or moved to the document `<head>`.
124124

125125
<SandpackWithHTMLOutput>
126126

0 commit comments

Comments
 (0)