client:load in Astro?client:load to a component, what is the expected behavior of that component on the client side?<MyComponent client:load />
client:load compared to other hydration directives.client:load tells Astro to hydrate the component immediately after the page loads on the client. This means the component is first rendered as static HTML on the server, then JavaScript runs to make it interactive right after loading.
<InfoCard client:??? />
If the component is purely static and does not require any interactivity, it is best to keep it static without hydration. This reduces JavaScript load and improves performance.
client:visible in Astro?<InteractiveWidget client:visible />What happens when the page loads and the widget is initially off-screen?
<InteractiveWidget client:visible />
client:visible delays hydration until the component is visible in the viewport. This saves resources by not hydrating components off-screen.
client:load?<MyButton client:load />But the button does not become interactive after page load. What is the most likely cause?
<MyButton client:load />
If the component's JavaScript is missing or not bundled, hydration cannot happen even if client:load is used. This results in a static, non-interactive component.
Static rendering is best for content that never changes and does not require user interaction, like a simple footer. Hydrating such components wastes resources.