-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/test settings page #4
base: main
Are you sure you want to change the base?
Conversation
const isShowOption = (settingOptionType: SettingOptionType) => | ||
editingState[settingOptionType] !== EditingStateType.EMPTY; |
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.
editingState에 대해 메모이제이션을 해도 좋을 것 같음
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.
현재 컴포넌트는 state 를 editingState 하나만 쓰이기 때문에 메모이제이션을 사용할 필요가 없음. (useCallback) 그러나
추후 state가 추가가 될 가능성이 있다면 미리 useCallback 을 써주는 것이 좋으나,
하나의 컴포넌트는 최소한의 state 를 가질수있도록 코딩하는 것이 객체지향적으로 좋을듯함.
<Conditional condition={isShowOption(SettingOptionType.POSITION)}> | ||
<SettingPosition | ||
editingStateType={editingState[SettingOptionType.POSITION]} | ||
setEditingState={() => setEditingState(SettingOptionType.POSITION)} |
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 setOneOfEditingState = useCallback(
(settingOption: SettingOptionType) =>
() => setEditingState(settingOptionType),
[setEditingState]
);
이런 함수를 하나 만들어서 사용하면 좋을 것 같음
return ( | ||
<> | ||
<SettingOption | ||
question={"[] 분 동안 몸 풀래요"} |
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.
[]
에 변경된 내용이 반영되면 좋을 것 같음
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.
🧐
<> | ||
<SettingOption | ||
question={"[] 분 동안 몸 풀래요"} | ||
selectedOption={(!!selectedTime ? `${selectedTime} 분` : "") + ""} |
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.
selectedOption={(!!selectedTime ? `${selectedTime} 분` : "") + ""} | |
selectedOption={String(!!selectedTime ? `${selectedTime} 분` : "")} |
이렇게 표현하면 더 명확할듯
{question.substring(0, question.indexOf(SettingOptionalChar))} | ||
<span> | ||
{editingStateType === EditingStateType.COMPLETE | ||
? selectedOption | ||
: "..."} | ||
</span> | ||
{question.substring( | ||
question.indexOf(SettingOptionalChar) + SettingOptionalChar.length, | ||
question.length | ||
)} |
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.
더 단순하게 표현할 수 있지 않을까?
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.