Skip to content

Commit a085508

Browse files
committed
hydrate document
1 parent 229f77f commit a085508

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/content/reference/react-dom/client/hydrateRoot.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,36 @@ function Counter() {
198198
199199
---
200200
201+
### ربط مستند بأكمله {/*hydrating-an-entire-document*/}
202+
203+
يمكن للتطبيقات المُبنَّية بالكامل بواسطة React أن تعرض المستند بأكمله على شكل JSX، بما في ذلك العلامة [`<html>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html) :
204+
205+
```js {3,13}
206+
function App() {
207+
return (
208+
<html>
209+
<head>
210+
<meta charSet="utf-8" />
211+
<meta name="viewport" content="width=device-width, initial-scale=1" />
212+
<link rel="stylesheet" href="/styles.css"></link>
213+
<title>تطبيقي</title>
214+
</head>
215+
<body>
216+
<Router />
217+
</body>
218+
</html>
219+
);
220+
}
221+
```
222+
223+
لترطيب المستند بأكمله، مرر الكائن العام (`document`) كأول معامل إلى `hydrateRoot`:
224+
225+
```js {4}
226+
import { hydrateRoot } from 'react-dom/client';
227+
import App from './App.js';
228+
229+
hydrateRoot(document, <App />);
230+
```
231+
232+
---
233+

0 commit comments

Comments
 (0)