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

HT4 #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

HT4 #42

wants to merge 1 commit into from

Conversation

Bochesan
Copy link

No description provided.

};

export default Restaurant;
export default connect((state, ownProps) => ({
name: state.restaurants[ownProps.id].name,
Copy link
Owner

Choose a reason for hiding this comment

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

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

const tabs = restaurants.map((restaurant) => ({
title: restaurant.name,
content: <Restaurant restaurant={restaurant} />,
const tabs = Object.keys(restaurants).map((id) => ({
Copy link
Owner

Choose a reason for hiding this comment

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

Object.keys(restaurants) должно быть в селекторах и мемоизировано

Review.defaultProps = {
user: 'Anonymous',
const mapStateToProps = (state, ownProps) => {
const review = state.reviews[ownProps.id];
Copy link
Owner

Choose a reason for hiding this comment

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

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

const userId = uuidv4();
const reviewId = uuidv4();

action.payload = {
Copy link
Owner

Choose a reason for hiding this comment

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

не стоит мутировать action, лучше создать новый


export const averageRatingSelector = (state, props) =>
createSelector(reviewSelector, (reviews) => {
const restaurantReviews = state.restaurants[props.id].reviews;
Copy link
Owner

Choose a reason for hiding this comment

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

лучше не делать одновременно и обычный селектор и createSelector

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