숨은 로직 드러내기 | Frontend Fundamentals #64
Replies: 2 comments 7 replies
-
안녕하세요! 그래도 반환타입을 명시해주는게 좋을까요? 제가 생각했을때 반환타입을 적어주면 좋은 이점은
정도인데.. async function fetchBalance(): Promise<number> {
const balance = await http.get<number>("...");
return balance;
} |
Beta Was this translation helpful? Give feedback.
6 replies
-
이 문서에 대해서 질문이있습니다. 이전 코드 async function fetchBalance(): Promise<number> {
const balance = await http.get<number>("...");
logging.log("balance_fetched");
return balance;
} 여기서 두가지 문제를 언급하셨는데
그러면서 아래처럼 개선을 보여주셨는데요, 개선 코드 async function fetchBalance(): Promise<number> {
const balance = await http.get<number>("...");
return balance;
}
// 필요한 경우
const balance = await fetchBalance();
logging.log("balance_fetched");
await syncBalance(balance); 개선 코드가 단순히 로깅을 빼고 필요한곳에서 하신다는게 의아합니다. 차라리 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
숨은 로직 드러내기 | Frontend Fundamentals
변경하기 쉬운 프론트엔드 코드를 위한 지침서
https://frontend-fundamentals.com/code/examples/hidden-logic.html
Beta Was this translation helpful? Give feedback.
All reactions