Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Домашнее задание 5 #6

Merged
merged 4 commits into from
Dec 6, 2018
Merged

Домашнее задание 5 #6

merged 4 commits into from
Dec 6, 2018

Conversation

denisstasyev
Copy link
Owner

Переделал проект на React. Осталась только проблема с overflow-y, то есть у MessageList не совсем корректно CSS работает. Буду рад, если подскажешь как исправить)

@@ -18,10 +18,10 @@ class FileButton extends React.Component {
reader.onload = function() {
if (file.type.startsWith("image/")) {
text = reader.result;
this_ptr.props.updateData("", getTime(), text);
this_ptr.props.updateData(this_ptr.props.id + 1, "", text);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Такс, а этот this_ptr я пропустил. Так делать неправильно, ведь, в js есть методы для проброса контекста bind, apply, call и еще есть arrow functions, где контекст не меняется вовсе. Это надо исправить

}

cleanValue() {
this.refs.textMessageForm.value = "";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Тоже что-то странное. Данными полей надо оперировать через state

Copy link
Collaborator

@martinkomitsky martinkomitsky left a comment

Choose a reason for hiding this comment

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

Приходи сегодня на защиту, на месте будем разбираться


var files = event.target.files;

for (var i = 0; i < files.length; i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Использовать перечисляющий метод forEach(val, ind) => {...}


for (var i = 0; i < files.length; i++) {
// eslint-disable-next-line no-loop-func
(function(file) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Вынести в нормальную функцию и избавиться от IIFE

}

updateDataMessageForm(text) {
this.setState({ text: text });
Copy link
Collaborator

Choose a reason for hiding this comment

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

{ text }

@martinkomitsky martinkomitsky merged commit 2b55563 into master Dec 6, 2018
@martinkomitsky
Copy link
Collaborator

5

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants