-
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
[ht4] normalisation fixes and review posts #65
base: master
Are you sure you want to change the base?
Conversation
const mapStateToProps = (state, ownProps) => { | ||
const { reviews } = ownProps.restaurant; | ||
return { | ||
reviews: reviews.map((id) => state.reviews[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.
это нужно выносить в селекторы и мемоизировать.
case SET_ACTIVE: | ||
return action.payload; | ||
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 uuidGenerator = () => (next) => (action) => { | ||
if (action.type === ADD_REVIEW) { | ||
action.payload.userId = uuidv4(); |
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
case ADD_REVIEW: | ||
const { id, activeRestaurant } = action.payload; | ||
const restaurant = restaurants[activeRestaurant]; | ||
restaurant.reviews.push(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.
мутации в редьюсере недопустимы
No description provided.