-
Notifications
You must be signed in to change notification settings - Fork 13
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
base: master
Are you sure you want to change the base?
HT4 #42
Conversation
}; | ||
|
||
export default Restaurant; | ||
export default connect((state, ownProps) => ({ | ||
name: state.restaurants[ownProps.id].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.
это нужно выносить в селекторы
const tabs = restaurants.map((restaurant) => ({ | ||
title: restaurant.name, | ||
content: <Restaurant restaurant={restaurant} />, | ||
const tabs = Object.keys(restaurants).map((id) => ({ |
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.
Object.keys(restaurants) должно быть в селекторах и мемоизировано
Review.defaultProps = { | ||
user: 'Anonymous', | ||
const mapStateToProps = (state, ownProps) => { | ||
const review = state.reviews[ownProps.id]; |
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 userId = uuidv4(); | ||
const reviewId = uuidv4(); | ||
|
||
action.payload = { |
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.
не стоит мутировать action, лучше создать новый
|
||
export const averageRatingSelector = (state, props) => | ||
createSelector(reviewSelector, (reviews) => { | ||
const restaurantReviews = state.restaurants[props.id].reviews; |
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.
лучше не делать одновременно и обычный селектор и createSelector
No description provided.