Skip to content

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

Merged
merged 4 commits into from
Feb 14, 2019
Merged

Handling Events #9

merged 4 commits into from
Feb 14, 2019

Conversation

mihilbabin
Copy link
Contributor

Added uk translation for handling events.


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-елементу після його створення. Натомість, просто вкажіть обробник,коли елемент вперше відрендерився.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed space обробник,коли

Copy link
Member

@vldmrkl vldmrkl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Чудовий початок! Я знайшов небагато дрібних помилок, але вцілому дуже гарно 👍


```html
<a href="#" onclick="console.log('The link was clicked.'); return false">
Click me
</a>
```

In React, this could instead be:
В React це може виглядати так:
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'this це:'на просто 'це:'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут під this мається на увазі ключове слово this і те чому this в контексті метода дорівнює.

</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` створюється щоразу нова функція зворотнього виклику. В більшості випадків це не створює додаткових проблем. Але, якщо ця функція зворотнього виклику передається в якості проп в компоненти нижче - вони можуть здійснити додатковий ререндеринг. Як правило, ми рекомендуємо зв'язувати в конструкторі або використувати синтаксис полей класу, щоб уникнути подібних проблем з продуктивністю.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Прибрати щоразу

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У більшості випадків замість В більшості випадків

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Замінити передається в якості проп на передається в якості пропу

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можливо краще якості пропса. Хоч і не множина, але не має неузгодженості, коли props перекладаємо пропсів(пропси) замість пропів(пропи )

Copy link
Member

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 – як пропси.


## Passing Arguments to Event Handlers {#passing-arguments-to-event-handlers}
## Передача аргументів у обробники подій {#passing-arguments-to-event-handlers}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

До обробників подій?

Copy link
Contributor Author

@mihilbabin mihilbabin Feb 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можна й так, параметр передається в функцію, але певно до обробника. Є пропозиція означити це в TRANSLATION.md.

</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` створюється щоразу нова функція зворотнього виклику. В більшості випадків це не створює додаткових проблем. Але, якщо ця функція зворотнього виклику передається в якості проп в компоненти нижче - вони можуть здійснити додатковий ререндеринг. Як правило, ми рекомендуємо зв'язувати в конструкторі або використувати синтаксис полей класу, щоб уникнути подібних проблем з продуктивністю.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можливо краще якості пропса. Хоч і не множина, але не має неузгодженості, коли props перекладаємо пропсів(пропси) замість пропів(пропи )

Copy link
Member

@vldmrkl vldmrkl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job!

@vldmrkl vldmrkl merged commit 7038276 into reactjs:master Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants