Skip to content

Commit 8f67a62

Browse files
authored
Merge pull request #74 from splimter/Translating-fragments.md
Done Translating-fragments.md
2 parents 9f4a0ea + 3567f1e commit 8f67a62

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

content/docs/fragments.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
id: fragments
3-
title: Fragments
3+
title: استخدام الأجزاء (Fragments)
44
permalink: docs/fragments.html
55
---
66

7-
A common pattern in React is for a component to return multiple elements. Fragments let you group a list of children without adding extra nodes to the DOM.
7+
من الأنماط الشائعة في React هي إعادة المكوّن لعناصر متعددة. تتيح لك الأجزاء (Fragments) تجميع قائمة من العناصر الأبناء بدون إضافة عُقَد إضافيّة إلى DOM.
88

99
```js
1010
render() {
@@ -18,11 +18,11 @@ render() {
1818
}
1919
```
2020

21-
There is also a new [short syntax](#short-syntax) for declaring them, but it isn't supported by all popular tools yet.
21+
هناك أيضًا [صياغة مختصرة](#short-syntax) جديدة للتصريح عنها، ولكنّها غير مدعومة من قبل كافة الأدوات الشائعة حتى الآن.
2222

23-
## Motivation {#motivation}
23+
## البداية {#motivation}
2424

25-
A common pattern is for a component to return a list of children. Take this example React snippet:
25+
من الأنماط الشائعة للمكوّن هي إعادة قائمة من المكونات الأبناء. انظر إلى هذا المثال:
2626

2727
```jsx
2828
class Table extends React.Component {
@@ -38,7 +38,7 @@ class Table extends React.Component {
3838
}
3939
```
4040

41-
`<Columns />` would need to return multiple `<td>` elements in order for the rendered HTML to be valid. If a parent div was used inside the `render()` of `<Columns />`, then the resulting HTML will be invalid.
41+
سيحتاج المكوّن `<Columns />` إلى إعادة عناصر `<td>` متعددة لكي تكون HTML المُصيَّرة صالحة. إن كان عنصر `div` الأب مُستخدمًا بداخل التابع `render()` للمكون `<Columns />`, فستكون HTML الناتجة غير صالحة:
4242

4343
```jsx
4444
class Columns extends React.Component {
@@ -53,7 +53,7 @@ class Columns extends React.Component {
5353
}
5454
```
5555

56-
results in a `<Table />` output of:
56+
ينتج عنه جدول `<Table />`:
5757

5858
```jsx
5959
<table>
@@ -66,9 +66,9 @@ results in a `<Table />` output of:
6666
</table>
6767
```
6868

69-
Fragments solve this problem.
69+
وبهذا نقدم الأجزاء Fragments.
7070

71-
## Usage {#usage}
71+
## الاستخدام {#usage}
7272

7373
```jsx{4,7}
7474
class Columns extends React.Component {
@@ -83,7 +83,7 @@ class Columns extends React.Component {
8383
}
8484
```
8585

86-
which results in a correct `<Table />` output of:
86+
والذي ينتج عنه جدول صحيح `<Table />`:
8787

8888
```jsx
8989
<table>
@@ -94,9 +94,9 @@ which results in a correct `<Table />` output of:
9494
</table>
9595
```
9696

97-
### Short Syntax {#short-syntax}
97+
### صياغة مختصرة {#short-syntax}
9898

99-
There is a new, shorter syntax you can use for declaring fragments. It looks like empty tags:
99+
هنالك صياغة جديدة مختصرة أكثر بإمكانك استخدامها للتصريح عن الأجزاء. تبدو هذه الصياغة مثل العناصر الفارغة:
100100

101101
```jsx{4,7}
102102
class Columns extends React.Component {
@@ -111,13 +111,13 @@ class Columns extends React.Component {
111111
}
112112
```
113113

114-
You can use `<></>` the same way you'd use any other element except that it doesn't support keys or attributes.
114+
بإمكانك استخدام`<></>` بنفس الطريقة التي تستخدم بها أي عنصر آخر عدا أنها لا تدعم المفاتيح أو الخاصيّات.
115115

116-
Note that **[many tools don't support it yet](/blog/2017/11/28/react-v16.2.0-fragment-support.html#support-for-fragment-syntax)** so you might want to explicitly write `<React.Fragment>` until the tooling catches up.
116+
لاحظ أنّ **[العديد من الأدوات لا تدعمها حتى الآن](/blog/2017/11/28/react-v16.2.0-fragment-support.html#support-for-fragment-syntax)** لذا قد تحتاج إلى أن تكتب بصراحة `<React.Fragment>` حتى تصبح الأدوات تدعم الصياغة المختصرة.
117117

118-
### Keyed Fragments {#keyed-fragments}
118+
### استخدام الأجزاء مع المفاتيح {#keyed-fragments}
119119

120-
Fragments declared with the explicit `<React.Fragment>` syntax may have keys. A use case for this is mapping a collection to an array of fragments -- for example, to create a description list:
120+
يُمكِن للأجزاء المُصرَّح عنها عن طريق الصياغة `<React.Fragment>` أن تمتلك مفاتيح. إحدى حالات الاستخدام لها هي ربط مجموعة إلى مصفوفة من الأجزاء، على سبيل المثال لإنشاء قائمة للوصف:
121121

122122
```jsx
123123
function Glossary(props) {
@@ -135,8 +135,8 @@ function Glossary(props) {
135135
}
136136
```
137137

138-
`key` is the only attribute that can be passed to `Fragment`. In the future, we may add support for additional attributes, such as event handlers.
138+
الخاصية الوحيدة التي يمكن تمريرها للأجزاء `Fragment` هي المفتاح `key`. قد نُضيف مستقبلًا دعم لخاصيّات إضافية مثل مُعالجات الأحداث.
139139

140-
### Live Demo {#live-demo}
140+
### تجربة المثال {#live-demo}
141141

142-
You can try out the new JSX fragment syntax with this [CodePen](https://codepen.io/reactjs/pen/VrEbjE?editors=1000).
142+
بإمكانك تجربة صياغة الأجزاء الجديدة في JSX عن طريق هذا المثال في موقع [CodePen](https://codepen.io/reactjs/pen/VrEbjE?editors=1000).

0 commit comments

Comments
 (0)