Skip to content

Conversation

@airosso
Copy link

@airosso airosso commented May 5, 2019

No description provided.

@vercel
Copy link

vercel bot commented May 5, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://task-5-git-fork-airosso-master.itmo-yandex.now.sh

Copy link

@mokhov mokhov left a comment

Choose a reason for hiding this comment

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

Основное замечание – это выбор разбиения на компоненты (всё в App), нужно поправить

}

export class App extends Component<{}, AppState> {
readonly state: AppState = {
Copy link

Choose a reason for hiding this comment

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

Логику работы с письмами (выделение, удаление, открытие) нужно перенести из app в компонент «Список писем».

Copy link
Author

Choose a reason for hiding this comment

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

Измененное задание нужно сдать очно?


componentDidMount() {
const this2 = this;
(function sendEmails([time1, time2]: [number, number]) {
Copy link

Choose a reason for hiding this comment

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

Это можно вынести в функцию вне компонента, т.к это синтетический код для задания


deleteSelected = () => {
const deletedKeys = this.state.letters.filter(x => !!x.selected).map(x => x.key);
this.setState(({ letters }) => {
Copy link

Choose a reason for hiding this comment

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

Для удобства обычно в setState называют prevState. По аналогии можно называть и прошлое состояние конкретного поля. Тогда не будет путанице в нейминге

});
};

toggleLetter = (id: number) => {
Copy link

Choose a reason for hiding this comment

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

Вот тут написано плохо. toggle должен быть методом письма. Сейчас и знание об зачекнутости должно быть внутри него, а наружу это должен быть state письма. Тогда не будет этого прохода по списку писем. Почему это плохо? Потому что чем больше писем, тем больше проходов по всему списку, тем медленнее работает приложение

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.

2 participants