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

Ht7 #57

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Ht7 #57

wants to merge 2 commits into from

Conversation

tatiyanakryzhnyaya
Copy link

No description provided.

const productsSelector = (state) => state.products.entities;
const reviewsSelector = (state) => state.reviews.entities;
const usersSelector = (state) => state.users.entities;
const historyRouterSelector = (state) => state.router;
Copy link
Owner

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));
Copy link
Owner

Choose a reason for hiding this comment

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

лучше делать такого же вида екшены, как и на загрузку данных (через REQUEST, SUCCESS, FAILURE) - тогда все будет в едином стиле и проще для понимания

Copy link
Author

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) => {
Copy link
Owner

Choose a reason for hiding this comment

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

используйте селекторы

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