Skip to content
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

Lesson5 #70

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Lesson5 #70

wants to merge 8 commits into from

Conversation

Mm5623
Copy link

@Mm5623 Mm5623 commented Oct 29, 2021

No description provided.

if (!reviwesLoading && !reviewsLoaded) loadReviews(id);
}, [id, loadReviews, reviwesLoading, reviewsLoaded]);

const rateComponent = useMemo(() => {
Copy link
Owner

Choose a reason for hiding this comment

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

useMemo стоит использовать именно для хранения данных, а не JSX разметки

@@ -38,6 +40,15 @@ export default (state = initialState, action) => {
loaded: false,
error,
};

case LOAD_PRODUCTS + SUCCESS:
Copy link
Owner

Choose a reason for hiding this comment

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

эта обработка тут лишняя, у нас и так в ресторане уже есть информация о его меню и отзывам

export default produce((draft = defaultState, action) => {
const { type, data, restId, error } = action;
switch (type) {
case LOAD_RESTAURANTS + SUCCESS:
Copy link
Owner

Choose a reason for hiding this comment

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

да, такой подход вынесения флагов loading/loaded в отдельный редьюсер тоже встречается, но стоит это делать в более плоской структуре без глубокой вложенности

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