-
Notifications
You must be signed in to change notification settings - Fork 16
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
Feature/home task 4 #67
base: master
Are you sure you want to change the base?
Conversation
Added reducers fixes and selectors, fixed review component
@@ -46,4 +47,8 @@ Restaurant.propTypes = { | |||
}).isRequired, | |||
}; | |||
|
|||
export default Restaurant; | |||
const mapStateToProps = (state) => ({ | |||
allReviews: state.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.
тут необходимо использовать селекторы
|
||
const tabs = useMemo( | ||
() => restaurants.map(({ id, name }) => ({ id, label: name })), | ||
() => Object.keys(restaurants).map((key) => { |
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.
это вычисление лучше перенести в селекторы
|
||
export default (store) => (next) => (action) => { | ||
if (action.type === ADD_REVIEW) { | ||
action.payload.id = 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, расскажу при разборе домашки почему
export default (products = defaultUsers, action) => { | ||
const { type } = action; | ||
|
||
switch (type) { |
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.
пропущено добавление нового юзера из ревью
<div className={styles.rate}> | ||
<Rate value={rating} /> | ||
function Review({review, users}) { | ||
const user = users[review?.userId] ? users[review?.userId] : null; |
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.