-
Notifications
You must be signed in to change notification settings - Fork 125
Handling Events #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
content/docs/handling-events.md
Outdated
|
||
When using React you should generally not need to call `addEventListener` to add listeners to a DOM element after it is created. Instead, just provide a listener when the element is initially rendered. | ||
Зазвичай, коли ви використовуєте React, вам не потрібно викликати `addEventListener`, щоб додати обробник до DOM-елементу після його створення. Натомість, просто вкажіть обробник,коли елемент вперше відрендерився. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed space обробник,коли
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Чудовий початок! Я знайшов небагато дрібних помилок, але вцілому дуже гарно 👍
content/docs/handling-events.md
Outdated
|
||
```html | ||
<a href="#" onclick="console.log('The link was clicked.'); return false"> | ||
Click me | ||
</a> | ||
``` | ||
|
||
In React, this could instead be: | ||
В React це може виглядати так: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У React
замість В React
|
||
```js{7-9} | ||
class LoggingButton extends React.Component { | ||
handleClick() { | ||
console.log('this is:', this); | ||
console.log('this це:', this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'this це:'
на просто 'це:'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут під this
мається на увазі ключове слово this
і те чому this
в контексті метода дорівнює.
content/docs/handling-events.md
Outdated
</button> | ||
); | ||
} | ||
} | ||
``` | ||
|
||
The problem with this syntax is that a different callback is created each time the `LoggingButton` renders. In most cases, this is fine. However, if this callback is passed as a prop to lower components, those components might do an extra re-rendering. We generally recommend binding in the constructor or using the class fields syntax, to avoid this sort of performance problem. | ||
Проблема цього синтаксису полягає в тому, що при кожному рендері `LoggingButton` створюється щоразу нова функція зворотнього виклику. В більшості випадків це не створює додаткових проблем. Але, якщо ця функція зворотнього виклику передається в якості проп в компоненти нижче - вони можуть здійснити додатковий ререндеринг. Як правило, ми рекомендуємо зв'язувати в конструкторі або використувати синтаксис полей класу, щоб уникнути подібних проблем з продуктивністю. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Прибрати щоразу
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У більшості випадків
замість В більшості випадків
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Замінити передається в якості проп
на передається в якості пропу
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можливо краще якості пропса
. Хоч і не множина, але не має неузгодженості, коли props
перекладаємо пропсів
(пропси
) замість пропів
(пропи
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@westanvv згідно нашого TRANSLATE.md, prop перекладаємо як проп, а props – як пропси.
content/docs/handling-events.md
Outdated
|
||
## Passing Arguments to Event Handlers {#passing-arguments-to-event-handlers} | ||
## Передача аргументів у обробники подій {#passing-arguments-to-event-handlers} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
До обробників подій?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можна й так, параметр передається в функцію
, але певно до обробника
. Є пропозиція означити це в TRANSLATION.md.
content/docs/handling-events.md
Outdated
</button> | ||
); | ||
} | ||
} | ||
``` | ||
|
||
The problem with this syntax is that a different callback is created each time the `LoggingButton` renders. In most cases, this is fine. However, if this callback is passed as a prop to lower components, those components might do an extra re-rendering. We generally recommend binding in the constructor or using the class fields syntax, to avoid this sort of performance problem. | ||
Проблема цього синтаксису полягає в тому, що при кожному рендері `LoggingButton` створюється щоразу нова функція зворотнього виклику. В більшості випадків це не створює додаткових проблем. Але, якщо ця функція зворотнього виклику передається в якості проп в компоненти нижче - вони можуть здійснити додатковий ререндеринг. Як правило, ми рекомендуємо зв'язувати в конструкторі або використувати синтаксис полей класу, щоб уникнути подібних проблем з продуктивністю. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можливо краще якості пропса
. Хоч і не множина, але не має неузгодженості, коли props
перекладаємо пропсів
(пропси
) замість пропів
(пропи
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job!
Added uk translation for handling events.