You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The`preconnect`function provides the browser with a hint that it should open a connection to the given server. If the browser chooses to do so, this can speed up the loading of resources from that server.
37
+
توفّر`preconnect`للمتصفّح تلميحاً بأن يفتح اتصالاً بالخادم المحدّد. إن اختار المتصفّح ذلك، قد يسرّع تحميل الموارد من ذلك الخادم.
38
38
39
-
#### Parameters {/*parameters*/}
39
+
#### المعاملات {/*parameters*/}
40
40
41
-
*`href`: a string. The URL of the server you want to connect to.
41
+
*`href`: سلسلة نصية. عنوان URL للخادم الذي تريد الاتصال به.
42
42
43
43
44
-
#### Returns {/*returns*/}
44
+
#### القيمة المُرجَعة {/*returns*/}
45
45
46
-
`preconnect`returns nothing.
46
+
لا تُرجِع `preconnect`شيئاً.
47
47
48
-
#### Caveats {/*caveats*/}
48
+
#### ملاحظات {/*caveats*/}
49
49
50
-
*Multiple calls to`preconnect`with the same server have the same effect as a single call.
51
-
*In the browser, you can call `preconnect`in any situation: while rendering a component, in an Effect, in an event handler, and so on.
52
-
*In server-side rendering or when rendering Server Components, `preconnect` only has an effect if you call it while rendering a component or in an async context originating from rendering a component. Any other calls will be ignored.
53
-
*If you know the specific resources you'll need, you can call [other functions](/reference/react-dom/#resource-preloading-apis)instead that will start loading the resources right away.
54
-
*There is no benefit to preconnecting to the same server the webpage itself is hosted from because it's already been connected to by the time the hint would be given.
50
+
*عدة استدعاءات لـ`preconnect`لنفس الخادم لها نفس أثر استدعاء واحد.
51
+
*في المتصفّح يمكن استدعاء `preconnect`في أي موضع: أثناء تصيير مكوّن، أو في Effect، أو في معالج حدث، إلخ.
52
+
*في التصيير على الخادم أو عند تصيير مكوّنات الخادم، لا يكون لـ `preconnect` أثر إلا إذا استُدعي أثناء تصيير مكوّن أو في سياق async منبثق من تصيير مكوّن. تُتجاهل أي استدعاءات أخرى.
53
+
*إن كنت تعرف الموارد المحدّدة التي تحتاجها، يمكنك استدعاء [دوال أخرى](/reference/react-dom/#resource-preloading-apis)تبدأ تحميل الموارد فوراً.
54
+
*لا فائدة من الاتصال المسبق بنفس الخادم الذي يستضيف الصفحة لأن الاتصال قائم بالفعل قبل أن يُعطى التلميح.
55
55
56
56
---
57
57
58
-
## Usage {/*usage*/}
58
+
## الاستخدام {/*usage*/}
59
59
60
-
### Preconnecting when rendering {/*preconnecting-when-rendering*/}
60
+
### الاتصال المسبق أثناء التصيير {/*preconnecting-when-rendering*/}
61
61
62
-
Call`preconnect`when rendering a component if you know that its children will load external resources from that host.
62
+
استدعِ`preconnect`أثناء تصيير مكوّن إن كنت تعلم أن الأبناء سيحمّلون موارد خارجية من ذلك المضيف.
63
63
64
64
```js
65
65
import { preconnect } from'react-dom';
@@ -70,9 +70,9 @@ function AppRoot() {
70
70
}
71
71
```
72
72
73
-
### Preconnecting in an event handler {/*preconnecting-in-an-event-handler*/}
73
+
### الاتصال المسبق في معالج حدث {/*preconnecting-in-an-event-handler*/}
74
74
75
-
Call`preconnect`in an event handler before transitioning to a page or state where external resources will be needed. This gets the process started earlier than if you call it during the rendering of the new page or state.
75
+
استدعِ`preconnect`في معالج حدث قبل الانتقال إلى صفحة أو حالة سيُحمّل فيها موارد خارجية. يبدأ ذلك مبكراً أكثر من الاستدعاء أثناء تصيير الصفحة أو الحالة الجديدة.
To look up a host, call the `prefetchDNS`function from`react-dom`.
23
+
للبحث عن مضيف، استدعِ الدالة `prefetchDNS`من`react-dom`.
24
24
25
25
```js
26
26
import { prefetchDNS } from'react-dom';
@@ -32,34 +32,34 @@ function AppRoot() {
32
32
33
33
```
34
34
35
-
[See more examples below.](#usage)
35
+
[المزيد من الأمثلة أدناه.](#usage)
36
36
37
-
The prefetchDNS function provides the browser with a hint that it should look up the IP address of a given server. If the browser chooses to do so, this can speed up the loading of resources from that server.
37
+
توفّر `prefetchDNS` للمتصفّح تلميحاً بأن يبحث عن عنوان IP لخادم معيّن. إن اختار المتصفّح ذلك، قد يسرّع تحميل الموارد من ذلك الخادم.
38
38
39
-
#### Parameters {/*parameters*/}
39
+
#### المعاملات {/*parameters*/}
40
40
41
-
*`href`: a string. The URL of the server you want to connect to.
41
+
*`href`: سلسلة نصية. عنوان URL للخادم.
42
42
43
-
#### Returns {/*returns*/}
43
+
#### القيمة المُرجَعة {/*returns*/}
44
44
45
-
`prefetchDNS`returns nothing.
45
+
لا تُرجِع `prefetchDNS`شيئاً.
46
46
47
-
#### Caveats {/*caveats*/}
47
+
#### ملاحظات {/*caveats*/}
48
48
49
-
*Multiple calls to`prefetchDNS`with the same server have the same effect as a single call.
50
-
*In the browser, you can call `prefetchDNS`in any situation: while rendering a component, in an Effect, in an event handler, and so on.
51
-
*In server-side rendering or when rendering Server Components, `prefetchDNS` only has an effect if you call it while rendering a component or in an async context originating from rendering a component. Any other calls will be ignored.
52
-
*If you know the specific resources you'll need, you can call [other functions](/reference/react-dom/#resource-preloading-apis)instead that will start loading the resources right away.
53
-
*There is no benefit to prefetching the same server the webpage itself is hosted from because it's already been looked up by the time the hint would be given.
54
-
*Compared with[`preconnect`](/reference/react-dom/preconnect), `prefetchDNS`may be better if you are speculatively connecting to a large number of domains, in which case the overhead of preconnections might outweigh the benefit.
49
+
*عدة استدعاءات لـ`prefetchDNS`لنفس الخادم لها نفس أثر استدعاء واحد.
50
+
*في المتصفّح يمكن استدعاء `prefetchDNS`في أي موضع: أثناء تصيير مكوّن، أو في Effect، أو في معالج حدث، إلخ.
51
+
*في التصيير على الخادم أو عند تصيير مكوّنات الخادم، لا يكون لـ `prefetchDNS` أثر إلا إذا استُدعي أثناء تصيير مكوّن أو في سياق async منبثق من تصيير مكوّن. تُتجاهل أي استدعاءات أخرى.
52
+
*إن كنت تعرف الموارد المحدّدة، يمكنك استدعاء [دوال أخرى](/reference/react-dom/#resource-preloading-apis)تبدأ التحميل فوراً.
53
+
*لا فائدة من prefetch لنفس خادم الصفحة لأن البحث قد تم بالفعل.
54
+
*مقارنةً بـ[`preconnect`](/reference/react-dom/preconnect)، قد يكون `prefetchDNS`أفضل إذا اتصلت تخمينياً بعدد كبير من النطاقات، حيث قد يفوق عبء الاتصالات المسبقة الفائدة.
55
55
56
56
---
57
57
58
-
## Usage {/*usage*/}
58
+
## الاستخدام {/*usage*/}
59
59
60
-
### Prefetching DNS when rendering {/*prefetching-dns-when-rendering*/}
60
+
### prefetch لـ DNS أثناء التصيير {/*prefetching-dns-when-rendering*/}
61
61
62
-
Call`prefetchDNS`when rendering a component if you know that its children will load external resources from that host.
62
+
استدعِ`prefetchDNS`أثناء تصيير مكوّن إن كنت تعلم أن الأبناء سيحمّلون موارد من ذلك المضيف.
63
63
64
64
```js
65
65
import { prefetchDNS } from'react-dom';
@@ -70,9 +70,9 @@ function AppRoot() {
70
70
}
71
71
```
72
72
73
-
### Prefetching DNS in an event handler {/*prefetching-dns-in-an-event-handler*/}
73
+
### prefetch لـ DNS في معالج حدث {/*prefetching-dns-in-an-event-handler*/}
74
74
75
-
Call`prefetchDNS`in an event handler before transitioning to a page or state where external resources will be needed. This gets the process started earlier than if you call it during the rendering of the new page or state.
75
+
استدعِ`prefetchDNS`في معالج حدث قبل الانتقال إلى صفحة أو حالة سيُحمّل فيها موارد خارجية.
Copy file name to clipboardExpand all lines: src/content/reference/rsc/directives.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,18 @@ title: "التوجيهات (Directives)"
4
4
5
5
<RSC>
6
6
7
-
Directives are for use in [React Server Components](/reference/rsc/server-components).
7
+
التوجيهات مخصّصة للاستخدام مع [مكوّنات خادم React](/reference/rsc/server-components).
8
8
9
9
</RSC>
10
10
11
11
<Intro>
12
12
13
-
تستخدم React علامتي توجيه، لإعلام أدوات التجميع (bundlers) بأن ملفاتك تحتوي على [مكونات من جانب الخادم RSC](/learn/creating-a-react-app#full-stack-frameworks)، والتعليمات اللازمة لذلك.
13
+
تستخدم React علامتي توجيه لإعلام أدوات التجميع (bundlers) بأن ملفاتك تحتوي على [مكوّنات خادم React (RSC)](/learn/creating-a-react-app#full-stack-frameworks)، والتعليمات اللازمة لذلك.
14
14
</Intro>
15
15
16
16
---
17
17
18
-
## توجيهات الكود {/*source-code-directives*/}
18
+
## توجيهات الشيفرة {/*source-code-directives*/}
19
19
20
-
*[`'use client'`](/reference/rsc/use-client)تميز الملف بأن ما فيه مكون من جانب العميل (client-side).
21
-
*[`'use server'`](/reference/rsc/use-server)تميز الدوال من جانب الخادم (server-side) التي يمكن استدعاؤها من الكود من جانب العميل (client-side).
20
+
*[`'use client'`](/reference/rsc/use-client)يوسّم الملف بأن ما فيه يُنفَّذ على جانب العميل (client).
21
+
*[`'use server'`](/reference/rsc/use-server)يوسّم الدوال التي تعمل على الخادم ويمكن استدعاؤها من شيفرة العميل.
0 commit comments