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

HT-4: fix reviews & post new review #64

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

Conversation

vskosp
Copy link

@vskosp vskosp commented Nov 30, 2020

No description provided.

@@ -24,3 +31,15 @@ export const totalSelector = createSelector(
(orderProducts) =>
orderProducts.reduce((acc, { subtotal }) => acc + subtotal, 0)
);

export const makeRatingSelector = () => createSelector(
Copy link
Owner

@koretskiyav koretskiyav Dec 1, 2020

Choose a reason for hiding this comment

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

а в чем смысл этой функции?

Copy link
Author

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;
Copy link
Owner

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,
Copy link
Owner

Choose a reason for hiding this comment

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

это нужно выносить в селекторы

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