-
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 #55
base: master
Are you sure you want to change the base?
Ht7 #55
Conversation
@@ -15,6 +16,9 @@ function BasketItem({ | |||
decrement, | |||
remove, | |||
}) { | |||
const activeCurrency = useSelector(activeCurrencySelector); |
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.
вот это все вычисление повторяется много раза и его лучше вынести в отдельный файл, я покажу на своей домашке, как это лучше делать
return <Loader />; | ||
} | ||
if (checkOutState.loaded) { | ||
history.push('/checkout/success'); |
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> | ||
</div> | ||
<Link to="/checkout"> | ||
<Button primary block> | ||
<Button onClick={onCheckoutClickHandler} primary block> |
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 [currencyName, currencyValue] = Object.entries(activeCurrency)[0]; | ||
const history = useHistory(); | ||
const dispatch = useDispatch(); | ||
const checkOutState = useSelector((state) => state.checkout); |
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.
используйте отдельно написаные селекторы
@@ -63,3 +74,25 @@ export const loadUsers = () => async (dispatch, getState) => { | |||
|
|||
dispatch(_loadUsers()); | |||
}; | |||
|
|||
export const checkoutProducts = (basketItems) => async (dispatch) => { | |||
const itemsArr = basketItems.map((basketItem) => { |
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.
тут так же можно использовать селектор
))} | ||
<TransitionGroup> | ||
{reviews.map((id) => ( | ||
<CSSTransition key={id} timeout={1300} classNames={{ ...styles }}> |
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.
сюда лучше не передавать лишние стили, которые не касаются анимации (либо отдельный файл сделать, либо из объекта стилей отобрать нужное)
HT7 ready
!!!currency implements via redux but not context,
TODO
animation should be added.