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 #55

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

Ht7 #55

wants to merge 5 commits into from

Conversation

chertt007
Copy link

HT7 ready
!!!currency implements via redux but not context,
TODO
animation should be added.

@@ -15,6 +16,9 @@ function BasketItem({
decrement,
remove,
}) {
const activeCurrency = useSelector(activeCurrencySelector);
Copy link
Owner

Choose a reason for hiding this comment

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

вот это все вычисление повторяется много раза и его лучше вынести в отдельный файл, я покажу на своей домашке, как это лучше делать

return <Loader />;
}
if (checkOutState.loaded) {
history.push('/checkout/success');
Copy link
Owner

@koretskiyav koretskiyav Jan 22, 2021

Choose a reason for hiding this comment

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

это лучше делать на уровне редакса, непосредственно при получение ответа с сервера, а не в компоненте

</div>
</div>
<Link to="/checkout">
<Button primary block>
<Button onClick={onCheckoutClickHandler} primary block>
Copy link
Owner

Choose a reason for hiding this comment

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

в этом случае проще сделать две отдельные кнопки

const [currencyName, currencyValue] = Object.entries(activeCurrency)[0];
const history = useHistory();
const dispatch = useDispatch();
const checkOutState = useSelector((state) => state.checkout);
Copy link
Owner

Choose a reason for hiding this comment

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

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

@@ -63,3 +74,25 @@ export const loadUsers = () => async (dispatch, getState) => {

dispatch(_loadUsers());
};

export const checkoutProducts = (basketItems) => async (dispatch) => {
const itemsArr = basketItems.map((basketItem) => {
Copy link
Owner

Choose a reason for hiding this comment

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

тут так же можно использовать селектор

))}
<TransitionGroup>
{reviews.map((id) => (
<CSSTransition key={id} timeout={1300} classNames={{ ...styles }}>
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