Skip to content

Россомахина Арина, M3337#21

Open
airosso wants to merge 4 commits intoitmo2019:masterfrom
airosso:master
Open

Россомахина Арина, M3337#21
airosso wants to merge 4 commits intoitmo2019:masterfrom
airosso:master

Conversation

@airosso
Copy link
Copy Markdown

@airosso airosso commented May 5, 2019

No description provided.

@vercel
Copy link
Copy Markdown

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
Copy Markdown

@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), нужно поправить

Comment thread src/app/app.tsx
}

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

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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

Comment thread src/app/app.tsx

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

Choose a reason for hiding this comment

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

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

Comment thread src/app/app.tsx

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

Choose a reason for hiding this comment

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

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

Comment thread src/app/app.tsx
});
};

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

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