Skip to content

Commit

Permalink
Incorporated feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmccabe committed Dec 18, 2023
1 parent fc396ee commit 8eb2dfd
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/content/reference/react-dom/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ These APIs can be imported from your components. They are rarely used:

## Resource Preloading APIs {/*resource-preloading-apis*/}

These APIs can be used to make apps faster by pre-loading resources such as scripts, stylesheets, and fonts as soon as you know you need them, for example before navigating to another page where the resources will be used:
These APIs can be used to make apps faster by pre-loading resources such as scripts, stylesheets, and fonts as soon as you know you need them, for example before navigating to another page where the resources will be used.

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

* [`prefetchDNS`](/reference/react-dom/prefetchDNS) lets you prefetch the IP address of a DNS domain name that you expect to connect to.
* [`preconnect`](/reference/react-dom/preconnect) lets you connect to a server you expect to request resources from, even if you don't know what resources you'll need yet.
* [`preload`](/reference/react-dom/preload) lets you fetch a stylesheet, font, image, or external script that you expect to use.
* [`preloadModule`](/reference/react-dom/preloadModule) lets you fetch an ESM module that you expect to use.
* [`preinit`](/reference/react-dom/preinit) lets you fetch and evaluate an external script or fetch and insert a stylesheet.
* [`preinitModule`](/reference/react-dom/preinitModule) lets you fetch and evaluate an ESM module.
* [`prefetchDNS`](/reference/react-dom/prefetchDNS) lets you prefetch the IP address of a DNS domain name that you expect to connect to.
* [`preconnect`](/reference/react-dom/preconnect) lets you connect to a server you expect to request resources from, even if you don't know what resources you'll need yet.



---

Expand Down
7 changes: 7 additions & 0 deletions src/content/reference/react-dom/preconnect.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
---
title: preconnect
canary: true
---

<Canary>

The `preconnect` function is currently only available in React's Canary and experimental channels. Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).

</Canary>

<Intro>

`preconnect` lets you eagerly connect to a server that you expect to load resources from.
Expand Down
7 changes: 7 additions & 0 deletions src/content/reference/react-dom/prefetchDNS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
---
title: prefetchDNS
canary: true
---

<Canary>

The `prefetchDNS` function is currently only available in React's Canary and experimental channels. Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).

</Canary>

<Intro>

`prefetchDNS` lets you eagerly look up the IP of a server that you expect to load resources from.
Expand Down
13 changes: 13 additions & 0 deletions src/content/reference/react-dom/preinit.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
---
title: preinit
canary: true
---

<Canary>

The `preinit` function is currently only available in React's Canary and experimental channels. Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).

</Canary>

<Note>

[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.

</Note>

<Intro>

`preinit` lets you eagerly fetch and evaluate a stylesheet or external script.
Expand Down
13 changes: 13 additions & 0 deletions src/content/reference/react-dom/preinitModule.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
---
title: preinitModule
canary: true
---

<Canary>

The `preinitModule` function is currently only available in React's Canary and experimental channels. Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).

</Canary>

<Note>

[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.

</Note>

<Intro>

`preinitModule` lets you eagerly fetch and evaluate an ESM module.
Expand Down
17 changes: 14 additions & 3 deletions src/content/reference/react-dom/preload.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
---
title: preload
canary: true
---

<Canary>

The `preload` function is currently only available in React's Canary and experimental channels. Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).

</Canary>

<Note>

[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.

</Note>

<Intro>

`preload` lets you eagerly fetch a resource such as a stylesheet, font, or external script that you expect to use.
Expand Down Expand Up @@ -40,7 +53,7 @@ The `preload` function provides the browser with a hint that it should start dow

* `href`: a string. The URL of the resource you want to download.
* `options`: an object. It contains the following properties:
* `as`: a required string. The type of resource. Its possible values are `audio`, `document`, `embed`, `fetch`, `font`, `image`, `object`, `script`, `style`, `track`, `video`, `worker`.
* `as`: a required string. The type of resource. Its [possible values](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#as) are `audio`, `document`, `embed`, `fetch`, `font`, `image`, `object`, `script`, `style`, `track`, `video`, `worker`.
* `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`. It is required when `as` is set to `"fetch"`.
* `referrerPolicy`: a string. The [Referrer header](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#referrerpolicy) to send when fetching. Its possible values are `no-referrer-when-downgrade` (the default), `no-referrer`, `origin`, `origin-when-cross-origin`, and `unsafe-url`.
* `integrity`: a string. A cryptographic hash of the resource, to [verify its authenticity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
Expand All @@ -50,8 +63,6 @@ The `preload` function provides the browser with a hint that it should start dow
* `imageSrcSet`: a string. For use only with `as: "image"`. Specifies the [source set of the image](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images).
* `imageSizes`: a string. For use only with `as: "image"`. Specifies the [sizes of the image](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images).



#### Returns {/*returns*/}

`preload` returns nothing.
Expand Down
13 changes: 13 additions & 0 deletions src/content/reference/react-dom/preloadModule.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
---
title: preloadModule
canary: true
---

<Canary>

The `preloadModule` function is currently only available in React's Canary and experimental channels. Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).

</Canary>

<Note>

[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.

</Note>

<Intro>

`preloadModule` lets you eagerly fetch an ESM module that you expect to use.
Expand Down
18 changes: 12 additions & 6 deletions src/sidebarReference.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,27 +243,33 @@
},
{
"title": "preconnect",
"path": "/reference/react-dom/preconnect"
"path": "/reference/react-dom/preconnect",
"canary": true
},
{
"title": "prefetchDNS",
"path": "/reference/react-dom/prefetchDNS"
"path": "/reference/react-dom/prefetchDNS",
"canary": true
},
{
"title": "preinit",
"path": "/reference/react-dom/preinit"
"path": "/reference/react-dom/preinit",
"canary": true
},
{
"title": "preinitModule",
"path": "/reference/react-dom/preinitModule"
"path": "/reference/react-dom/preinitModule",
"canary": true
},
{
"title": "preload",
"path": "/reference/react-dom/preload"
"path": "/reference/react-dom/preload",
"canary": true
},
{
"title": "preloadModule",
"path": "/reference/react-dom/preloadModule"
"path": "/reference/react-dom/preloadModule",
"canary": true
},
{
"title": "render",
Expand Down

0 comments on commit 8eb2dfd

Please sign in to comment.