Skip to content

Commit 2844d52

Browse files
docs(ar): StrictMode heading/format fix after lint-staged
Made-with: Cursor
1 parent 4b8266a commit 2844d52

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

src/content/reference/react/StrictMode.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -826,22 +826,22 @@ button { margin-left: 10px; }
826826
827827
</Sandpack>
828828
829-
Notice how the active connection count in the console doesn't keep growing anymore.
829+
لاحظ أن عدد الاتصالات النشطة في وحدة التحكم لم يعد يتزايد باستمرار.
830830
831-
Without Strict Mode, it was easy to miss that your Effect needed cleanup. By running *setupcleanupsetup* instead of *setup* for your Effect in development, Strict Mode made the missing cleanup logic more noticeable.
831+
بدون Strict Mode، كان من السهل تفويت أن تأثيرك يحتاج تنظيمًا. بتشغيل *إعدادتنظيفإعداد* بدل *إعداد* فقط لتأثيرك في التطوير، جعل Strict Mode نقص منطق التنظيف أكثر بروزًا.
832832
833-
[Read more about implementing Effect cleanup.](/learn/synchronizing-with-effects#how-to-handle-the-effect-firing-twice-in-development)
833+
[اقرأ المزيد عن تنفيذ تنظيف التأثير.](/learn/synchronizing-with-effects#how-to-handle-the-effect-firing-twice-in-development)
834834
835835
---
836-
### Fixing bugs found by re-running ref callbacks in development {/*fixing-bugs-found-by-re-running-ref-callbacks-in-development*/}
836+
### إصلاح أخطاء يكشفها إعادة تشغيل استدعاءات ref في التطوير {/*fixing-bugs-found-by-re-running-ref-callbacks-in-development*/}
837837
838-
Strict Mode can also help find bugs in [callbacks refs.](/learn/manipulating-the-dom-with-refs)
838+
يمكن لـ Strict Mode أيضًا المساعدة في إيجاد أخطاء في [استدعاءات ref (callback refs).](/learn/manipulating-the-dom-with-refs)
839839
840-
Every callback `ref` has some setup code and may have some cleanup code. Normally, React calls setup when the element is *created* (is added to the DOM) and calls cleanup when the element is *removed* (is removed from the DOM).
840+
لكل callback `ref` كود إعداد وقد يكون له تنظيف. عادةً، تستدعي React الإعداد عند *إنشاء* العنصر (إضافته إلى DOM) والتنظيف عند *إزالته* من DOM.
841841
842-
When Strict Mode is on, React will also run **one extra setup+cleanup cycle in development for every callback `ref`.** This may feel surprising, but it helps reveal subtle bugs that are hard to catch manually.
842+
عند تفعيل Strict Mode، تشغّل React أيضًا **دورة إعداد+تنظيف إضافية في التطوير لكل callback `ref`.** قد يبدو ذلك مفاجئًا، لكنه يكشف أخطاء دقيقة يصعُب اصطيادها يدويًا.
843843
844-
Consider this example, which allows you to select an animal and then scroll to one of them. Notice when you switch from "Cats" to "Dogs", the console logs show that the number of animals in the list keeps growing, and the "Scroll to" buttons stop working:
844+
انظر إلى هذا المثال الذي يتيح اختيار حيوان ثم التمرير إليه. لاحظ عند التبديل بين «Cats» و«Dogs» أن سجلات وحدة التحكم تُظهر أن عدد الحيوانات في القائمة يزداد، وتتوقف أزرار «Scroll to» عن العمل:
845845
846846
<Sandpack>
847847
@@ -960,9 +960,9 @@ li {
960960
</Sandpack>
961961
962962
963-
**This is a production bug!** Since the ref callback doesn't remove animals from the list in the cleanup, the list of animals keeps growing. This is a memory leak that can cause performance problems in a real app, and breaks the behavior of the app.
963+
**هذا خطأ إنتاجي!** بما أن callback الـ ref لا يزيل الحيوانات من القائمة في التنظيف، تستمر القائمة بالنمو. هذا تسرّب ذاكرة قد يسبب مشاكل أداء في تطبيق حقيقي، ويكسر سلوك التطبيق.
964964
965-
The issue is the ref callback doesn't cleanup after itself:
965+
المشكلة أن callback الـ ref لا ينظّف نفسه:
966966
967967
```js {6-8}
968968
<li
@@ -977,7 +977,7 @@ The issue is the ref callback doesn't cleanup after itself:
977977
</li>
978978
```
979979
980-
Now let's wrap the original (buggy) code in `<StrictMode>`:
980+
الآن لِنلفّ الكود الأصلي (الخاطئ) بـ`<StrictMode>`:
981981
982982
<Sandpack>
983983
@@ -1100,9 +1100,9 @@ li {
11001100
11011101
</Sandpack>
11021102
1103-
**With Strict Mode, you immediately see that there is a problem**. Strict Mode runs an extra setup+cleanup cycle for every callback ref. This callback ref has no cleanup logic, so it adds refs but doesn't remove them. This is a hint that you're missing a cleanup function.
1103+
**مع Strict Mode، ترى فورًا أن هناك مشكلة.** يشغّل Strict Mode دورة إعداد+تنظيف إضافية لكل callback ref. هذا الـ callback بلا تنظيف، فيضيف عناصر ولا يزيلها. هذا تلميح بأنك تفتقد دالة تنظيف.
11041104
1105-
Strict Mode lets you eagerly find mistakes in callback refs. When you fix your callback by adding a cleanup function in Strict Mode, you *also* fix many possible future production bugs like the "Scroll to" bug from before:
1105+
يساعدك Strict Mode على اكتشاف أخطاء callback refs مبكرًا. عندما تُصلح الـ callback بإضافة تنظيف في Strict Mode، *تُصلح* أيضًا أخطاء إنتاج محتملة كثيرة مثل خطأ «Scroll to» السابق:
11061106
11071107
<Sandpack>
11081108
@@ -1226,7 +1226,7 @@ li {
12261226
12271227
</Sandpack>
12281228
1229-
Now on inital mount in StrictMode, the ref callbacks are all setup, cleaned up, and setup again:
1229+
الآن عند التركيب الأول في StrictMode، تُستدعى استدعاءات الـ ref كلها: إعداد، ثم تنظيف، ثم إعداد مجددًا:
12301230
12311231
```
12321232
...

0 commit comments

Comments
 (0)