Skip to content

Commit 18d68eb

Browse files
committed
Translating managing state
- Extracting state logic into a reducer - Passing data deeply with context - Scaling up with reducer and context
1 parent 6059cf7 commit 18d68eb

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/content/learn/managing-state.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ title: إدارة الحالة
1212

1313
* [كيفية التفكير في تغييرات واجهة المستخدم كتغيرات في الحالة](/learn/reacting-to-input-with-state)
1414
* [كيفية هيكلة الحالة جيدا](/learn/choosing-the-state-structure)
15-
* [كيفية "رفع الحالة لمستوى أعلى" لمشاكارتها بين المكونات](/learn/sharing-state-between-components)
15+
* [كيفية "رفع الحالة لمستوى أعلى (lifting state up)" لمشاكارتها بين المكونات](/learn/sharing-state-between-components)
1616
* [كيفية التحكم في ما إذا تم حفظ الحالة أم إعادة تعيينها](/learn/preserving-and-resetting-state)
17-
* [كيفية ترسيخ منطق حالة معقد داخل دالة](/learn/extracting-state-logic-into-a-reducer)
18-
* [كيفية تمرير معلومات بدون "تسرب الخصائص"](/learn/passing-data-deeply-with-context)
17+
* [كيفية تجميع منطق حالة معقد داخل دالة](/learn/extracting-state-logic-into-a-reducer)
18+
* [كيفية تمرير معلومات بدون "تسرب الخصائص (Props drilling)"](/learn/passing-data-deeply-with-context)
1919
* [كيفية توسيع إدارة الحالة مع نمو تطبيقك](/learn/scaling-up-with-reducer-and-context)
2020

2121
</YouWillLearn>
@@ -232,7 +232,7 @@ label { display: block; margin-bottom: 5px; }
232232

233233
## مشاركة الحالة بين المكونات {/*sharing-state-between-components*/}
234234

235-
أحيانا، أنت تريد الحالة ذات المكونين أن تتغير دائما مع بعضها البعض. لعمل ذلك، احذف حالة من كليهما، انقلها لأقرب مكون أب، وبعد ذلك مررها لأسفل باستخدام الخصائص. هذا ما يعرف بـ "رفع الحالة لمستوى أعلى"، وهو واحد من أكثر الأشياء شيوعا التي ستسعملها أثناء كتابتك لكود React.
235+
أحيانا، أنت تريد الحالة ذات المكونين أن تتغير دائما مع بعضها البعض. لعمل ذلك، احذف حالة من كليهما، انقلها لأقرب مكون أب، وبعد ذلك مررها لأسفل باستخدام الخصائص. هذا ما يعرف بـ "رفع الحالة لمستوى أعلى (lifting state up)"، وهو واحد من أكثر الأشياء شيوعا التي ستسعملها أثناء كتابتك لكود React.
236236

237237
في هذا المثال، في كل مرة يجب أن تكون قائمة واحدة فقط نشطة. لتحقيق ذلك، بدلا من حفظ الحالة النشطة داخل كل قائمة بمفردها، المكونّ الأب يحمل الحالة ويحدد الخصائص لمكوناته الأبناء.
238238

@@ -501,9 +501,9 @@ textarea {
501501

502502
</LearnMore>
503503

504-
## Extracting state logic into a reducer {/*extracting-state-logic-into-a-reducer*/}
504+
## استخلاص منطق الحالة إلى مخفض (reducer) {/*extracting-state-logic-into-a-reducer*/}
505505

506-
Components with many state updates spread across many event handlers can get overwhelming. For these cases, you can consolidate all the state update logic outside your component in a single function, called "reducer". Your event handlers become concise because they only specify the user "actions". At the bottom of the file, the reducer function specifies how the state should update in response to each action!
506+
المكونات ذات تحديثات حالة كثيرة المنتشرة خلال كثير من معالجات الأحداث (event handlers) قد تصبح معقدة. لمثل هذه الأحوال، يمكنك تجميع جميع منطق تحديث الحالة خارج مكوّنك داخل دالة واحدة، تدعى "مخفض (reducer)". معالجات الأحداث خاصتك ستصبح موجزة لأنها تحدد "إجراءات (actions)" المستخدم فقط. في أسفل الملف، دالة المخفض تحدد كيف يجب أن تحدث الحالة إستجابة لكل إجراء!
507507

508508
<Sandpack>
509509

@@ -694,15 +694,15 @@ ul, li { margin: 0; padding: 0; }
694694

695695
<LearnMore path="/learn/extracting-state-logic-into-a-reducer">
696696

697-
Read **[Extracting State Logic into a Reducer](/learn/extracting-state-logic-into-a-reducer)** to learn how to consolidate logic in the reducer function.
697+
اقرأ **[استخلاص منطق الحالة إلى مخفض (reducer)](/learn/extracting-state-logic-into-a-reducer)** لتتعلم كيفية تجميع منطق داخل دالة المخفض.
698698

699699
</LearnMore>
700700

701-
## Passing data deeply with context {/*passing-data-deeply-with-context*/}
701+
## تمرير البيانات إلى عمق باستخدام السياق (context) {/*passing-data-deeply-with-context*/}
702702

703-
Usually, you will pass information from a parent component to a child component via props. But passing props can become inconvenient if you need to pass some prop through many components, or if many components need the same information. Context lets the parent component make some information available to any component in the tree below it—no matter how deep it is—without passing it explicitly through props.
703+
عادة، سوف تقوم بتمرير معلومات من مكوّن أب إلى مكوّن ابن بواسطة الخصائص (props). لكن تمرير الخصائص قد يكون غير مجدٍ لو احتجت لتمرير بعض الخصائص خلال مكونات عديدة، أو لو أن العديد من المكونات تحتاج نفس المعلومات. السياق (context) يتيح للمكون الأب جعل بعض المعلومات متوفرة لأي مكون أدناه في الشجرة-لا يهم مقدار عمق المكون-بدون تمريرها مباشرة عن طريق الخصائص.
704704

705-
Here, the `Heading` component determines its heading level by "asking" the closest `Section` for its level. Each `Section` tracks its own level by asking the parent `Section` and adding one to it. Every `Section` provides information to all components below it without passing props--it does that through context.
705+
هنا، المكوّن `Heading` يحدد مستوى عنوانه عن طريق "سؤال" أقرب `Section` لمستواها. كل `Section` يتتبع مستواه الخاص عن طريق سؤال `Section` الأب وإضافة واحد له. كل `Section` بتوفير معلومات لجميع المكونات أدناه دون نقل الخصائص--وهذا يتم عبر السياق (context).
706706

707707
<Sandpack>
708708

@@ -796,15 +796,15 @@ export const LevelContext = createContext(0);
796796

797797
<LearnMore path="/learn/passing-data-deeply-with-context">
798798

799-
Read **[Passing Data Deeply with Context](/learn/passing-data-deeply-with-context)** to learn about using context as an alternative to passing props.
799+
اقرأ **[تمرير البيانات إلى عمق باستخدام السياق (context)](/learn/passing-data-deeply-with-context)** لتتعلم عن استخدام السياق (context) كبديل لتمرير الخصائص.
800800

801801
</LearnMore>
802802

803-
## Scaling up with reducer and context {/*scaling-up-with-reducer-and-context*/}
803+
## التوسع بواسطة المخفض (reducer) و السياق (context) {/*scaling-up-with-reducer-and-context*/}
804804

805-
Reducers let you consolidate a component’s state update logic. Context lets you pass information deep down to other components. You can combine reducers and context together to manage state of a complex screen.
805+
المخفضات (Reducers) تتيح لك تجميع منطق تحديث الحالة لمكون. السياق (Context) تتيح لك تمرير معلومات بعمق إلى أسفل لمكونات أخرى. يمكنك جمع المخفضات والسايق معا لتدير الحالة الخاصة بشاشة معقدة.
806806

807-
With this approach, a parent component with complex state manages it with a reducer. Other components anywhere deep in the tree can read its state via context. They can also dispatch actions to update that state.
807+
مع هذا النهج، يدير المكون الأب حالة معقدة بواسطة مخفض. المكونات الأخرى في أي عمق كانت داخل الشجرة يمكن قراءة حالتها بواسطة السياق. يمكنهم أيضا إرسال الأوامر لتحديث الحالة.
808808

809809
<Sandpack>
810810

@@ -1007,12 +1007,12 @@ ul, li { margin: 0; padding: 0; }
10071007

10081008
<LearnMore path="/learn/scaling-up-with-reducer-and-context">
10091009

1010-
Read **[Scaling Up with Reducer and Context](/learn/scaling-up-with-reducer-and-context)** to learn how state management scales in a growing app.
1010+
اقرأ **[التوسع بواسطة المخفض (reducer) و السياق (context)](/learn/scaling-up-with-reducer-and-context)** لتتعلم كيف تتوسع إدارة الحالة في تطبيق نامٍ.
10111011

10121012
</LearnMore>
10131013

1014-
## What's next? {/*whats-next*/}
1014+
## ماذا بعد ذلك؟ {/*whats-next*/}
10151015

1016-
Head over to [Reacting to Input with State](/learn/reacting-to-input-with-state) to start reading this chapter page by page!
1016+
توجه إلى [الاستجابة للمدخلات باستخدام الحالة](/learn/reacting-to-input-with-state) لبدء قراءة هذا الفصل صفحة بصفحة!
10171017

1018-
Or, if you're already familiar with these topics, why not read about [Escape Hatches](/learn/escape-hatches)?
1018+
أو، إذا كنت بالفعل على دراية بهذه المواضيع، لماذا لا تقرأ عن [بوابات الهروب (Escape Hatches)](/learn/escape-hatches)؟

src/sidebarLearn.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,23 +134,23 @@
134134
"path": "/learn/choosing-the-state-structure"
135135
},
136136
{
137-
"title": "Sharing State Between Components",
137+
"title": "مشاكة الحالة بين المكونات",
138138
"path": "/learn/sharing-state-between-components"
139139
},
140140
{
141-
"title": "Preserving and Resetting State",
141+
"title": "حفظ وإعادة تعيين الحالة",
142142
"path": "/learn/preserving-and-resetting-state"
143143
},
144144
{
145-
"title": "Extracting State Logic into a Reducer",
145+
"title": "استخلاص منطق الحالة إلى مخفض (reducer)",
146146
"path": "/learn/extracting-state-logic-into-a-reducer"
147147
},
148148
{
149-
"title": "Passing Data Deeply with Context",
149+
"title": "تمرير البيانات إلى عمق باستخدام السياق (context)",
150150
"path": "/learn/passing-data-deeply-with-context"
151151
},
152152
{
153-
"title": "Scaling Up with Reducer and Context",
153+
"title": "التوسع بواسطة المخفض (reducer) و السياق (context)",
154154
"path": "/learn/scaling-up-with-reducer-and-context"
155155
}
156156
]

0 commit comments

Comments
 (0)