|
1 | 1 | --- |
2 | 2 | id: legacy-event-pooling |
3 | | -title: Event Pooling |
| 3 | +title: Hadisə Pulinqı |
4 | 4 | permalink: docs/legacy-event-pooling.html |
5 | 5 | --- |
6 | 6 |
|
7 | | ->Note |
| 7 | +>Qeyd |
8 | 8 | > |
9 | | ->This page is only relevant for React 16 and earlier, and for React Native. |
| 9 | +>Bu səhifə yalnız React 16 və köhnə versiyaları və React Native üçün münasibdir. |
10 | 10 | > |
11 | | ->React 17 on the web **does not** use event pooling. |
| 11 | +>React 17 vebdə event pulinqından **istifadə etmir**. |
12 | 12 | > |
13 | | ->[Read more](/blog/2020/08/10/react-v17-rc.html#no-event-pooling) about this change in React 17. |
| 13 | +>React 17-dəki bu dəyişiklik haqqında əlavə məlumat almaq üçün [bu bloq yazısını oxuyun](/blog/2020/08/10/react-v17-rc.html#no-event-pooling). |
14 | 14 |
|
15 | | -The [`SyntheticEvent`](/docs/events.html) objects are pooled. This means that the `SyntheticEvent` object will be reused and all properties will be nullified after the event handler has been called. For example, this won't work: |
| 15 | +[`SyntheticEvent`](/docs/events.html) obyektləri pul olunurlar. Bu deməkdir ki, hadisə callback-i çağrıldıqdan sonra `SyntheticEvent` obyekti yenidən işlədiləcək və bütün parametrləri sıfırlanacaq. Məsələn, aşağıdakı kod işləməyəcək: |
16 | 16 |
|
17 | 17 | ```javascript |
18 | 18 | function handleChange(e) { |
19 | | - // This won't work because the event object gets reused. |
| 19 | + // Hadisə obyekti yenidən işlənir deyə bu işləməyəcək. |
20 | 20 | setTimeout(() => { |
21 | | - console.log(e.target.value); // Too late! |
| 21 | + console.log(e.target.value); // Çox gecdir! |
22 | 22 | }, 100); |
23 | 23 | } |
24 | 24 | ``` |
25 | 25 |
|
26 | | -If you need to access event object's properties after the event handler has run, you need to call `e.persist()`: |
| 26 | +Hadisə işləyicisi icra olunduqdan sonra hadisənin dəyərlərini oxuya bilmək üçün `e.persist()` funksiyasını çağırmaq lazımdır: |
27 | 27 |
|
28 | 28 | ```javascript |
29 | 29 | function handleChange(e) { |
30 | | - // Prevents React from resetting its properties: |
| 30 | + // React-in hadisə parametrlərini sıfırlarmasının qarşısını alır: |
31 | 31 | e.persist(); |
32 | 32 |
|
33 | 33 | setTimeout(() => { |
34 | | - console.log(e.target.value); // Works |
| 34 | + console.log(e.target.value); // İşləyəcək |
35 | 35 | }, 100); |
36 | 36 | } |
37 | 37 | ``` |
0 commit comments