diff options
author | 2021-07-08 11:50:12 -0500 | |
---|---|---|
committer | 2021-07-08 11:50:12 -0500 | |
commit | ee4bcb57296d3631a253f25eb5e5aff2284c0bdb (patch) | |
tree | 3f0c204e67890be2e4ba4ecd8cccd1fe032764e5 | |
parent | 6287ec2b8e4aa844877f5b97d726105f90afd51f (diff) | |
download | astro-ee4bcb57296d3631a253f25eb5e5aff2284c0bdb.tar.gz astro-ee4bcb57296d3631a253f25eb5e5aff2284c0bdb.tar.zst astro-ee4bcb57296d3631a253f25eb5e5aff2284c0bdb.zip |
docs(#628): Clarify component rendering
Every component is rendered on the server at build time. Hydration directives _optionally_ add client-side hydration at runtime.
-rw-r--r-- | docs/core-concepts/component-hydration.md | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/core-concepts/component-hydration.md b/docs/core-concepts/component-hydration.md index ee1bdd777..434a621af 100644 --- a/docs/core-concepts/component-hydration.md +++ b/docs/core-concepts/component-hydration.md @@ -3,14 +3,14 @@ layout: ~/layouts/Main.astro title: React, Svelte, Vue, etc. --- -By default, Astro generates your site with zero client-side JavaScript. If you use any frontend UI components (React, Svelte, Vue, etc.) Astro will automatically render them to HTML and strip away any client-side JavaScript. This keeps your site default-fast. +By default, Astro generates your site with zero client-side JavaScript. If you use any frontend UI components (React, Svelte, Vue, etc.) Astro will automatically render them **on the server**, generating only HTML and CSS without any client-side JavaScript. This makes your site as fast as possible by default. ``` --- import MyReactComponent from '../components/MyReactComponent.jsx'; --- -<!-- By default: Astro renders this to HTML - and strips away all JavaScript. --> +<!-- By default: Astro renders this on the server, + generating HTML and CSS, but no client-side JavaScript. --> <MyReactComponent /> ``` @@ -25,11 +25,11 @@ With Astro, you can hydrate these components individually, without forcing the r ## Hydrate Frontend Components -To hydrate your components in the client, you may use any of the following techniques: +Astro renders every component on the server at build time. To hydrate your components on the client at runtime, you may use any of the following techniques: -- `<MyComponent:load />` will render the component on page load. -- `<MyComponent:idle />` will use [requestIdleCallback()][mdn-ric] to render the component as soon as main thread is free. -- `<MyComponent:visible />` will use an [IntersectionObserver][mdn-io] to render the component when the element enters the viewport. +- `<MyComponent:load />` will hydrate the component on page load. +- `<MyComponent:idle />` will use [requestIdleCallback()][mdn-ric] to hydrate the component as soon as main thread is free. +- `<MyComponent:visible />` will use an [IntersectionObserver][mdn-io] to hydrate the component when the element enters the viewport. ## Hydrate Astro Components |