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

[럼카] 2주차 2번째 PR #104

Merged
merged 12 commits into from
May 22, 2022

Conversation

yongseongjeon
Copy link
Collaborator

에드님 안녕하세요.

리뷰 해주셔서 감사합니다.

데모 페이지입니다.

진행 상황

@yongseongjeon yongseongjeon added the review-FE New feature or request label May 20, 2022
@yongseongjeon yongseongjeon requested a review from sungik-choi May 20, 2022 08:07
Copy link

@sungik-choi sungik-choi left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!
관리해야할 상태가 점점 늘어나면서 Context도 선형적으로 함께 증가하는걸 느끼실 거 같아요. 서로 연관된 상태들이 항상 묶여서 변하는 모습도 보이구요. 어떻게 하면 중복을 줄이고, 더 유연하게 만들 수 있을지 다음 미션에서도 계속 고민해보시면서 공부해나가시면 정말 좋을 거 같습니다! 💯

setInputMode(false);
setEventLog([...eventLog, { type: 'CHARGE', value: newMoney }]);

function chargeMoney(money) {

Choose a reason for hiding this comment

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

이 함수를 좀 더 잘게 나누고, reduce를 사용한 방식으로 리팩토링해보시면 좋을 거 같아요! 현재는 한 눈에 로직을 알아보기가 쉽지 않아보여요.

</>
);

function handleClickedInputBtn() {

Choose a reason for hiding this comment

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

전재산을 투입한 이후 아무것도 구매하지 않은 상태로 다시 투입할 금액을 입력하면 이전에 투입했던 금액이 그대로 증발해버리고 있어요. 1. 50000원을 투입, 2. 8000원을 추가 투입 한 상황이라면 자판기 투입 금액이 8000원 이 아니라 58000원 이 되어야할 거 같네요!

(+ 혹시 아직 구현하지 않으신 기능이라면 이 코멘트는 무시해주셔도 괜찮습니다!)

@@ -1,3 +1,4 @@
/* eslint-disable no-restricted-syntax */

Choose a reason for hiding this comment

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

불필요한 주석으로 보이네요.

}

function getQuotient(parent, child) {
return Math.floor(parent, child);

Choose a reason for hiding this comment

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

Suggested change
return Math.floor(parent, child);
return Math.floor(child / parent);
  • 몫을 구하는 유틸 함수인데 이런 형태를 의도하신걸까요?
  • 사용처가 없는데, ModifiableInput 컴포넌트에서 사용할 수 있을 거 같네요.

return <Wrap>{eventLog.map(createEventLog)}</Wrap>;

function createEventLog({ type, value }, idx) {
if (type === 'CHARGE') {

Choose a reason for hiding this comment

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

이벤트 로그 텍스트만 조건문을 통해 가져오고, 마지막에 그 텍스트를 감싸는 컴포넌트를 리턴하면 중복을 줄일 수 있어 좋지 않을까요?

import { LoadingContext } from 'components/App';
import DELAY_MS from 'constants/delay';

function Loading() {

Choose a reason for hiding this comment

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

👍 이런 로딩 컴포넌트 좋네요!


function Loading() {
const { setLoading } = useContext(LoadingContext);
useEffect(handleLoading, []);

Choose a reason for hiding this comment

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

Suggested change
useEffect(handleLoading, []);
useEffect(function handleLoading() {
setTimeout(() => setLoading(false), DELAY_MS.LOADING);
}, []);

취향일수도 있는 부분인데, 저는 이런 형태가 코드(콜백)가 하는 일을 아래 라인(L16)으로 갈 필요 없이 바로 확인할 수 있어서 가독성에 더 좋다고 생각해요.

@sungik-choi sungik-choi merged commit 6ef7946 into codesquad-members-2022:rumka May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-FE New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants