homework-3#3
Open
W0x3R wants to merge 72 commits into
Open
Conversation
…locks with wrapper class (Tue, Aug 5, 2025, 5:15:33 PM)
…e, Aug 5, 2025, 5:18:44 PM)
… with a description of the project. the functionality of opening/closing the modal window has been implemented
…modal window controls has been changed
…ader have been added. (Fri, Aug 8, 2025, 4:46:46 PM)
…been created. (Fri, Aug 8, 2025, 4:50:12 PM)
| @@ -0,0 +1,20 @@ | |||
| import styles from "./PostLengthFilter.module.css" | |||
|
|
|||
| export const PostLengthFilter = ({ value, onFilterChange }) => { | |||
There was a problem hiding this comment.
useCallback для onFilterChange сам по себе не даёт эффекта: при каждом обновлении родителя произойдёт повторный рендер. Имеет смысл обернуть компонент в React.memo и убрать value из пропсов. Текущая оптимизация не срабатывает, потому что в родителе обновляется value, и это инициирует ререндер дочерних компонентов. Нет смысла делать этот инпут контролируемым, если мы берём значение из события и храним состояние локально.
| <input | ||
| id="post-length" | ||
| className={styles.input} | ||
| onChange={(e) => onFilterChange(e)} |
There was a problem hiding this comment.
Вообще передавать весь объект event не очень хорошо: родителю нужен только value.
| @@ -0,0 +1,9 @@ | |||
| import styles from "./Button.module.css" | |||
|
|
|||
| export const Button = ({ onClick, children, className }) => { | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1) Реализован функционал отображения модального окна с использованием паттерна Compound Components.
2) Создан HOC withLoading для расширения компонента PostList.
3) Реализован функционал для отображения и сворачивания/разворачивания комментариев.
4) Реализован функционал для фильтрации постов по длине заголовка.
5) Использованы оптимизации useMemo и useCallback в PostList.