-
Notifications
You must be signed in to change notification settings - Fork 20
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
HT-4: fix reviews & post new review #64
base: master
Are you sure you want to change the base?
Conversation
@@ -24,3 +31,15 @@ export const totalSelector = createSelector( | |||
(orderProducts) => | |||
orderProducts.reduce((acc, { subtotal }) => acc + subtotal, 0) | |||
); | |||
|
|||
export const makeRatingSelector = () => createSelector( |
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.
а в чем смысл этой функции?
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.
на случай, если он будет использоваться несколькими компонентами https://github.com/reduxjs/reselect#sharing-selectors-with-props-across-multiple-component-instances
case RESTAURANT_ACTIVATE: | ||
return payload.id; | ||
default: | ||
return activeRestaurant; |
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.
теперь знание о том, какой ресторан активный, храниться в двух местах - в этом редьюсере и в компоненте
const review = state.reviews[ownProps.id]; | ||
|
||
return { | ||
user: state.users[review?.userId]?.name, |
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.
это нужно выносить в селекторы
No description provided.