-
Notifications
You must be signed in to change notification settings - Fork 16
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
base: master
Are you sure you want to change the base?
Lesson5 #70
Conversation
if (!reviwesLoading && !reviewsLoaded) loadReviews(id); | ||
}, [id, loadReviews, reviwesLoading, reviewsLoaded]); | ||
|
||
const rateComponent = useMemo(() => { |
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.
useMemo стоит использовать именно для хранения данных, а не JSX разметки
@@ -38,6 +40,15 @@ export default (state = initialState, action) => { | |||
loaded: false, | |||
error, | |||
}; | |||
|
|||
case LOAD_PRODUCTS + SUCCESS: |
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.
эта обработка тут лишняя, у нас и так в ресторане уже есть информация о его меню и отзывам
export default produce((draft = defaultState, action) => { | ||
const { type, data, restId, error } = action; | ||
switch (type) { | ||
case LOAD_RESTAURANTS + SUCCESS: |
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.
да, такой подход вынесения флагов loading/loaded в отдельный редьюсер тоже встречается, но стоит это делать в более плоской структуре без глубокой вложенности
No description provided.