Skip to content

Commit b555c04

Browse files
authored
Add docs for <NoHydration> (#1158)
1 parent fd89e2d commit b555c04

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/routes/reference/components/data.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"error-boundary.mdx",
66
"for.mdx",
77
"index-component.mdx",
8+
"no-hydration.mdx",
89
"portal.mdx",
910
"show.mdx",
1011
"switch-and-match.mdx",
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: <NoHydration>
3+
---
4+
5+
The `<NoHydration>` component prevents the client-side hydration process from being applied to its children.
6+
During server-side rendering, components and elements wrapped within `<NoHydration>` will render normally on the server, contributing to the initial HTML output.
7+
However, during client-side hydration, Solid bypasses the hydration process for the content within `<NoHydration>`.
8+
This means that elements within `<NoHydration>` will not have event listeners attached by Solid, and their state will not be managed reactively on the client-side after the initial render.
9+
10+
:::info[Note]
11+
Placing a `<Hydration>` component inside `<NoHydration>` has no effect and will not override the `<NoHydration>` behavior.
12+
:::
13+
14+
## Example
15+
16+
```tsx
17+
import { NoHydration } from "solid-js/web";
18+
import { InteractiveComponent, StaticContent } from "./components";
19+
20+
function Example() {
21+
return (
22+
<div>
23+
<InteractiveComponent />
24+
<NoHydration>
25+
<StaticContent />
26+
</NoHydration>
27+
</div>
28+
);
29+
}
30+
```

0 commit comments

Comments
 (0)