Skip to content

Commit 3070b3b

Browse files
committed
translate side effects section
1 parent 942afb4 commit 3070b3b

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

content/docs/strict-mode.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ class MyComponent extends React.Component {
7878
>
7979
> CSS'te, düğümün tasarımın bir parçası olmasını istemiyorsanız [`display: contents`](https://developer.mozilla.org/en-US/docs/Web/CSS/display#display_contents) özelliğini kullanabilirsiniz.
8080
81-
### Detecting unexpected side effects {#detecting-unexpected-side-effects}
81+
### Beklenmeyen yan etkileri tespit etme {#detecting-unexpected-side-effects}
8282

83-
Conceptually, React does work in two phases:
84-
* The **render** phase determines what changes need to be made to e.g. the DOM. During this phase, React calls `render` and then compares the result to the previous render.
85-
* The **commit** phase is when React applies any changes. (In the case of React DOM, this is when React inserts, updates, and removes DOM nodes.) React also calls lifecycles like `componentDidMount` and `componentDidUpdate` during this phase.
83+
Kavramsal olarak, React iki aşamada çalışır:
84+
* **Render** aşaması, örneğin DOM'da hangi değişikliklerin yapılması gerektiğini belirler. Bu aşamada React, render'ı çağırır ve sonucu bir önceki render çağrısının sonucuyla karşılaştırır.
85+
* **Commit** aşaması, React'ın değişiklikleri uyguladığı aşamadır. React DOM durumunda, React bu DOM düğümlerini ekler, günceller ve kaldırır. React ayrıca bu aşamada `componentDidMount` ve `componentDidUpdate` gibi yaşam döngülerini çağırır.
8686

87-
The commit phase is usually very fast, but rendering can be slow. For this reason, the upcoming concurrent mode (which is not enabled by default yet) breaks the rendering work into pieces, pausing and resuming the work to avoid blocking the browser. This means that React may invoke render phase lifecycles more than once before committing, or it may invoke them without committing at all (because of an error or a higher priority interruption).
87+
Commit aşaması genellikle hızlıdır fakat render aşaması yavaş olabilir. Bu nedenle, yakında gelecek eşzamanlı (concurrent) yöntem (henüz varsayılan olarak etkin değil) render etme işini parçalara ayırır, tarayıcıyı engellememek için işi duraklatır ve devam ettirir. Bu, React'ın render aşaması yaşam döngülerini commit aşamasına hiç geçmeden (bir hata veya daha yüksek öncelikli kesinti nedeniyle) çağırabileceği ya da commit aşamasından önce bir kereden fazla çağırabileceği anlamına gelir.
8888

89-
Render phase lifecycles include the following class component methods:
89+
Render aşaması yaşam döngüleri aşağıdaki sınıf bileşeni metodlarını içerir:
9090
* `constructor`
9191
* `componentWillMount` (or `UNSAFE_componentWillMount`)
9292
* `componentWillReceiveProps` (or `UNSAFE_componentWillReceiveProps`)
@@ -96,26 +96,26 @@ Render phase lifecycles include the following class component methods:
9696
* `render`
9797
* `setState` updater functions (the first argument)
9898

99-
Because the above methods might be called more than once, it's important that they do not contain side-effects. Ignoring this rule can lead to a variety of problems, including memory leaks and invalid application state. Unfortunately, it can be difficult to detect these problems as they can often be [non-deterministic](https://en.wikipedia.org/wiki/Deterministic_algorithm).
99+
Yukarıdaki metodlar bir kereden fazla çağrılabileceğinden, yan etkiler içermemesi önemlidir. Bu kuralı göz ardı etmek, bellek sızıntıları (memory leak) ve geçersiz uygulama durumu (invalid application state) gibi çeşitli sorunlara yol açabilir. Ne yazık ki bu sorunları tespit etmek zor olabilir çünkü genellikle [belirlenebilir olmayabilirler](https://en.wikipedia.org/wiki/Deterministic_algorithm).
100100

101-
Strict mode can't automatically detect side effects for you, but it can help you spot them by making them a little more deterministic. This is done by intentionally double-invoking the following functions:
101+
Strict yöntemi, yan etkileri otomatik olarak tespit edemez ancak onları daha belirgin hale getirerek tespit etmenize yardımcı olabilir. Bu, aşağıdaki fonksiyonları bilinçli bir şekilde iki kere çağırarak (double-invoking) yapılır:
102102

103-
* Class component `constructor`, `render`, and `shouldComponentUpdate` methods
104-
* Class component static `getDerivedStateFromProps` method
105-
* Function component bodies
106-
* State updater functions (the first argument to `setState`)
107-
* Functions passed to `useState`, `useMemo`, or `useReducer`
103+
* Sınıf bileşeni `constructor`, `render`, ve `shouldComponentUpdate` metodları
104+
* Sınıf bileşeni statik `getDerivedStateFromProps` metodu
105+
* Fonksiyon bileşen gövdeleri
106+
* State güncelleyen fonksiyonlar (`setState`in ilk argümanı)
107+
* `useState`, `useMemo`, veya `useReducer`'a aktarılan fonksiyonlar
108108

109-
> Note:
109+
> Not:
110110
>
111-
> This only applies to development mode. _Lifecycles will not be double-invoked in production mode._
111+
> Bu sadece geliştirme modu için geçerlidir. _Yaşam döngüleri canlıda iki defa çağırılmayacaktır._
112112
113-
For example, consider the following code:
113+
Örneğin, aşağıdaki kodu ele alalım:
114114
`embed:strict-mode/side-effects-in-constructor.js`
115115

116-
At first glance, this code might not seem problematic. But if `SharedApplicationState.recordEvent` is not [idempotent](https://en.wikipedia.org/wiki/Idempotence#Computer_science_meaning), then instantiating this component multiple times could lead to invalid application state. This sort of subtle bug might not manifest during development, or it might do so inconsistently and so be overlooked.
116+
İlk bakışta bu kod sorunlu görünmeyebilir. Ancak `SharedApplicationState.recordEvent` [etkisiz](https://en.wikipedia.org/wiki/Idempotence#Computer_science_meaning) değilse, bu bileşeni birden çok kez başlatmak geçersiz uygulama durumuna yol açabilir. Bu türk ince bir hata geliştirme sırasında ortaya çıkmayabilir veya bunu tutarsız bir şekilde yaparak gözden kaçabilir.
117117

118-
By intentionally double-invoking methods like the component constructor, strict mode makes patterns like this easier to spot.
118+
Strict yöntemi, `constructor` gibi metodları kasıtlı olarak iki kere çağırarak, bu gibi desenlerin fark edilmesini sağlar.
119119

120120
### Detecting legacy context API {#detecting-legacy-context-api}
121121

0 commit comments

Comments
 (0)