summaryrefslogtreecommitdiff
path: root/docs/core-concepts/component-hydration.md
diff options
context:
space:
mode:
authorGravatar FredKSchott <FredKSchott@users.noreply.github.com> 2021-07-14 17:43:06 +0000
committerGravatar GitHub Actions <actions@github.com> 2021-07-14 17:43:06 +0000
commit1583ef173ae36eb9f325c2d163df17ea49e244a9 (patch)
treeb97a58f9e0004ffb208c4cf5db31d0c4215f9418 /docs/core-concepts/component-hydration.md
parentd40edb0b673f380c9eb9c07add3e0cd2371d9623 (diff)
downloadastro-1583ef173ae36eb9f325c2d163df17ea49e244a9.tar.gz
astro-1583ef173ae36eb9f325c2d163df17ea49e244a9.tar.zst
astro-1583ef173ae36eb9f325c2d163df17ea49e244a9.zip
[ci] yarn format
Diffstat (limited to 'docs/core-concepts/component-hydration.md')
-rw-r--r--docs/core-concepts/component-hydration.md12
1 files changed, 7 insertions, 5 deletions
diff --git a/docs/core-concepts/component-hydration.md b/docs/core-concepts/component-hydration.md
index 4371583a1..e4d217b76 100644
--- a/docs/core-concepts/component-hydration.md
+++ b/docs/core-concepts/component-hydration.md
@@ -38,9 +38,9 @@ _Note: Partial hydration is sometimes called "progressive enhancement" or "progr
## Concept: Island Architecture
-**Island architecture** is the idea of using partial hydration to build entire websites. Island architecture is an alternative to the popular idea of building your website into a client-side JavaScript bundle that must be shipped to the user.
+**Island architecture** is the idea of using partial hydration to build entire websites. Island architecture is an alternative to the popular idea of building your website into a client-side JavaScript bundle that must be shipped to the user.
-To quote Jason Miller, who [coined the phrase](https://jasonformat.com/islands-architecture/):
+To quote Jason Miller, who [coined the phrase](https://jasonformat.com/islands-architecture/):
> In an "islands" model, server rendering is not a bolt-on optimization aimed at improving SEO or UX. Instead, it is a fundamental part of how pages are delivered to the browser. The HTML returned in response to navigation contains a meaningful and immediately renderable representation of the content the user requested.
@@ -51,8 +51,6 @@ Besides the obvious performance benefits of sending less JavaScript down to the
![diagram](https://res.cloudinary.com/wedding-website/image/upload/v1596766231/islands-architecture-1.png)
-
-
## Hydrate Interactive Components
Astro renders every component on the server **at build time**. To hydrate components on the client **at runtime**, you may use any of the following `client:*` directives. A directive is a component attribute (always with a `:`) which tells Astro how your component should be rendered.
@@ -68,15 +66,19 @@ import MyReactComponent from '../components/MyReactComponent.jsx';
```
### `<MyComponent client:load />`
+
Hydrate the component on page load.
### `<MyComponent client:idle />`
+
Hydrate the component as soon as main thread is free (uses [requestIdleCallback()][mdn-ric]).
### `<MyComponent client:visible />`
+
Hydrate the component as soon as the element enters the viewport (uses [IntersectionObserver][mdn-io]). Useful for content lower down on the page.
-### `<MyComponent client:media={QUERY} />`
+### `<MyComponent client:media={QUERY} />`
+
Hydrate the component as soon as the browser matches the given media query (uses [matchMedia][mdn-mm]). Useful for sidebar toggles, or other elements that should only display on mobile or desktop devices.
## Can I Hydrate Astro Components?