-
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
Ht7 #57
base: master
Are you sure you want to change the base?
Ht7 #57
Conversation
const productsSelector = (state) => state.products.entities; | ||
const reviewsSelector = (state) => state.reviews.entities; | ||
const usersSelector = (state) => state.users.entities; | ||
const historyRouterSelector = (state) => state.router; |
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.
в connected-react-router есть свои селекторы, которые можно так же использовать
return { id: productId, amount: state[productId] }; | ||
}); | ||
|
||
dispatch(orderLoading(true)); |
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.
лучше делать такого же вида екшены, как и на загрузку данных (через REQUEST, SUCCESS, FAILURE) - тогда все будет в едином стиле и проще для понимания
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.
Я не очень поняла, как через REQUEST, SUCCESS, FAILURE это работает и зачем два значения в state, если можно ввести одно значение для определения,, что идет загрузка.
|
||
export const takeOrder = () => async (dispatch, getState) => { | ||
const state = orderSelector(getState()); | ||
const order = Object.keys(state).map((productId) => { |
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.