Skip to content

Commit b7b0920

Browse files
author
rgrnwd
committed
translate end of error boundaries page
1 parent c99efd4 commit b7b0920

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

content/docs/error-boundaries.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ class ErrorBoundary extends React.Component {
103103
> שמות הקומפוננטות שמוצגים במעקב הערימות תלוי בשם שהוגדר במאפיין [`Function.name`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name). אם אתם צריכים לתמוך בדפדפנים או מכשירים ישנים יותר שלא תומכים בזה באופן סטנדרטי (כמו IE 11 למשל), תוכלו להוסיף את המאפיין כ- polyfill שיוכלל ב-bundle האפליקציה, כמו [`function.name-polyfill`](https://github.com/JamesMGreene/Function.name). דרך נוספת היא לספק באופן ישיר את המאפיין [`displayName`](/docs/react-component.html#displayname) בכל קומפוננטה.
104104
105105

106-
## How About try/catch? {#how-about-trycatch}
106+
## מה עם בלוק try/catch? {#how-about-trycatch}
107107

108-
`try` / `catch` is great but it only works for imperative code:
108+
בלוק `try/catch` זה מצוין אבל עובד רק בקוד אימפרטיבי (קוד שמשנה את מצב האפליקציה):
109109

110110
```js
111111
try {
@@ -115,21 +115,22 @@ try {
115115
}
116116
```
117117

118-
However, React components are declarative and specify *what* should be rendered:
118+
לעומת זאת, קומפוננטות React הן דקלרטיביות ורק מציינות *מה* צריך לרנדר באפליקציה:
119119

120120
```js
121121
<Button />
122122
```
123123

124-
Error boundaries preserve the declarative nature of React, and behave as you would expect. For example, even if an error occurs in a `componentDidUpdate` method caused by a `setState` somewhere deep in the tree, it will still correctly propagate to the closest error boundary.
124+
גובלי שגיאות משמרים את האופן הדקלרטיבי של React ומספקים התנהגות דומה. לדוגמא, אפילו אם שגיאה צצה במתודת ה-`componentDidUpdate` שנגרמה איפשהו עמוק בתוך העץ בתוך `setState`, היא תוצף לגובל השגיאות הקרוב ביותר.
125125

126-
## How About Event Handlers? {#how-about-event-handlers}
126+
## מה עם מטפלי אירועים? {#how-about-event-handlers}
127127

128-
Error boundaries **do not** catch errors inside event handlers.
128+
גובלי שגיאות **לא** תופסים שגיאות מתוך מטפלי אירועים.
129129

130-
React doesn't need error boundaries to recover from errors in event handlers. Unlike the render method and lifecycle methods, the event handlers don't happen during rendering. So if they throw, React still knows what to display on the screen.
130+
React לא צריך גובלי שגיאות כדי להתאושש משגיאות במטפלי אירועים. בשונה מהמתודת הרינדור ומתודות מחזור החיים, שגיאות שצצות במטפלי האירועים לא קורות בזמן הרינדור. אז אם צצה שגיאה, React עדיין ידע מה להציג.
131+
132+
כשיש צורך לתפוס שגיאה במטפל האירועים, השתמשו בבלוק ה-`try` / `catch` כרגיל:
131133

132-
If you need to catch an error inside event handler, use the regular JavaScript `try` / `catch` statement:
133134

134135
```js{9-13,17-20}
135136
class MyComponent extends React.Component {
@@ -141,7 +142,7 @@ class MyComponent extends React.Component {
141142
142143
handleClick() {
143144
try {
144-
// Do something that could throw
145+
// קוד שזורק שגיאה
145146
} catch (error) {
146147
this.setState({ error });
147148
}
@@ -156,10 +157,10 @@ class MyComponent extends React.Component {
156157
}
157158
```
158159

159-
Note that the above example is demonstrating regular JavaScript behavior and doesn't use error boundaries.
160+
שימו לב שהדוגמא הנ״ל מדגימה קוד JavaScript סטנדרטי לטיפול בשגיאות ולא קשורה בשום אופן לגבולות שגיאות.
160161

161-
## Naming Changes from React 15 {#naming-changes-from-react-15}
162+
## שינוי שם מגרסה 15 {#naming-changes-from-react-15}
162163

163-
React 15 included a very limited support for error boundaries under a different method name: `unstable_handleError`. This method no longer works, and you will need to change it to `componentDidCatch` in your code starting from the first 16 beta release.
164+
גרסה 15 של React כללה תמיכה מוגבלת ביותר לגבולות שגיאות תחת מתודה בשם אחר: `unstable_handleError`. המתודה הזאת כבר לא נתמכת, ותאלצו לשנות אותה ל- `componentDidCatch` בקוד שלכם החל מגרסת הביתא הראשונה של React 16.
164165

165-
For this change, we’ve provided a [codemod](https://github.com/reactjs/react-codemod#error-boundaries) to automatically migrate your code.
166+
בשביל השינוי הזה, כללנו [משנה קוד (codemod)](https://github.com/reactjs/react-codemod#error-boundaries) כדי לעדכן באופן אוטומטי את הקוד הרלוונטי.

0 commit comments

Comments
 (0)