-
함수 옮기기와 필드 옮기기를 통해 한 모듈로 묶기
-
어설프게 분리된 로직을 인라인 리팩토링으로 처리해도 좋다.
- before
const isLastStep = (step) => step === "4"; const showExistToast = () => { const message = isLastStep(step) ? '저장하고 이탈' : '저장하지 않고 이탈'; toast(message); };
- after
const showExistToast = () => { const message = step === "4" ? '저장하고 이탈' : '저장하지 않고 이탈'; toast(message); };