|
1 | 1 | ---
|
2 | 2 | id: legacy-event-pooling
|
3 |
| -title: Event Pooling |
| 3 | +title: Esemény pooling |
4 | 4 | permalink: docs/legacy-event-pooling.html
|
5 | 5 | ---
|
6 | 6 |
|
7 |
| ->Note |
| 7 | +>Megjegyzés |
8 | 8 | >
|
9 |
| ->This page is only relevant for React 16 and earlier, and for React Native. |
| 9 | +>Ez az oldal csak a React 16 és korábbi veziókra, valamint React Native-re vonatkozik. |
10 | 10 | >
|
11 |
| ->React 17 on the web **does not** use event pooling. |
| 11 | +>A React 17 a weben **nem használ** esemény pooling-ot. |
12 | 12 | >
|
13 |
| ->[Read more](/blog/2020/08/10/react-v17-rc.html#no-event-pooling) about this change in React 17. |
| 13 | +>Erről a React 17 változásról [többet itt olvashatsz](/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 event handler has been called. For example, this won't work: |
| 15 | +A [`SyntheticEvent`](/docs/events.html) objektumok egy közös készletben vannak. Ez azt jelenti, hogy a `SyntheticEvent` objektum újrafelhasználható és minden tulajdonság ki lesz nullázva az esemény callbackjének meghívása után. Ez például nem fog működni: |
16 | 16 |
|
17 | 17 | ```javascript
|
18 | 18 | function handleChange(e) {
|
19 |
| - // This won't work because the event object gets reused. |
| 19 | + // Ez nem fog műküdni, mert az esemény objektumok újra fel lesznek használva. |
20 | 20 | setTimeout(() => {
|
21 |
| - console.log(e.target.value); // Too late! |
| 21 | + console.log(e.target.value); // Túl késő! |
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 | +Ha szeretnél egy esemény tulajdonságaihoz azután hozzáférni hogy az eseménykezelő lefutott, meg kell hogy hívd az `e.persist()` metódust: |
27 | 27 |
|
28 | 28 | ```javascript
|
29 | 29 | function handleChange(e) {
|
30 | 30 | // Prevents React from resetting its properties:
|
31 | 31 | e.persist();
|
32 | 32 |
|
33 | 33 | setTimeout(() => {
|
34 |
| - console.log(e.target.value); // Works |
| 34 | + console.log(e.target.value); // Ez működik |
35 | 35 | }, 100);
|
36 | 36 | }
|
37 | 37 | ```
|
0 commit comments