-
Notifications
You must be signed in to change notification settings - Fork 36
Россомахина Арина, M3337 #21
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
base: master
Are you sure you want to change the base?
Conversation
|
This pull request is automatically deployed with Now. Latest deployment for this branch: https://task-5-git-fork-airosso-master.itmo-yandex.now.sh |
mokhov
left a comment
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.
Основное замечание – это выбор разбиения на компоненты (всё в App), нужно поправить
| } | ||
|
|
||
| export class App extends Component<{}, AppState> { | ||
| readonly state: AppState = { |
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.
Логику работы с письмами (выделение, удаление, открытие) нужно перенести из app в компонент «Список писем».
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.
Измененное задание нужно сдать очно?
|
|
||
| componentDidMount() { | ||
| const this2 = this; | ||
| (function sendEmails([time1, time2]: [number, number]) { |
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.
Это можно вынести в функцию вне компонента, т.к это синтетический код для задания
|
|
||
| deleteSelected = () => { | ||
| const deletedKeys = this.state.letters.filter(x => !!x.selected).map(x => x.key); | ||
| this.setState(({ letters }) => { |
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.
Для удобства обычно в setState называют prevState. По аналогии можно называть и прошлое состояние конкретного поля. Тогда не будет путанице в нейминге
| }); | ||
| }; | ||
|
|
||
| toggleLetter = (id: number) => { |
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.
Вот тут написано плохо. toggle должен быть методом письма. Сейчас и знание об зачекнутости должно быть внутри него, а наружу это должен быть state письма. Тогда не будет этого прохода по списку писем. Почему это плохо? Потому что чем больше писем, тем больше проходов по всему списку, тем медленнее работает приложение
No description provided.